diff --git a/Assets/AddressableAssetsData.meta b/Assets/AddressableAssetsData.meta new file mode 100644 index 0000000..fee1aca --- /dev/null +++ b/Assets/AddressableAssetsData.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ddd48b4097b0b2b4a9e2624e21715d1a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AddressableAssetsData/AddressableAssetSettings.asset b/Assets/AddressableAssetsData/AddressableAssetSettings.asset new file mode 100644 index 0000000..90600f7 --- /dev/null +++ b/Assets/AddressableAssetsData/AddressableAssetSettings.asset @@ -0,0 +1,182 @@ +%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: 468a46d0ae32c3544b7d98094e6448a9, type: 3} + m_Name: AddressableAssetSettings + m_EditorClassIdentifier: + m_DefaultGroup: 4d882dacb0cf54c449d94345cde2d533 + m_currentHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_OptimizeCatalogSize: 0 + m_BuildRemoteCatalog: 0 + m_BundleLocalCatalog: 0 + m_CatalogRequestsTimeout: 0 + m_DisableCatalogUpdateOnStart: 0 + m_IgnoreUnsupportedFilesInBuild: 1 + m_UniqueBundleIds: 0 + m_NonRecursiveBuilding: 1 + m_CCDEnabled: 0 + m_maxConcurrentWebRequests: 3 + m_ContiguousBundles: 1 + m_StripUnityVersionFromBundleBuild: 0 + m_DisableVisibleSubAssetRepresentations: 0 + m_ShaderBundleNaming: 2 + m_ShaderBundleCustomNaming: PALLET_NAME_HERE + m_MonoScriptBundleNaming: 3 + m_CheckForContentUpdateRestrictionsOption: 0 + m_MonoScriptBundleCustomNaming: MARROW + m_RemoteCatalogBuildPath: + m_Id: f03d2a55457fa6e4f8d499c42217628e + m_RemoteCatalogLoadPath: + m_Id: c379e54b5a3413b4e95ede99b7df5856 + m_ContentStateBuildPathProfileVariableName: + m_CustomContentStateBuildPath: + m_ContentStateBuildPath: + m_BuildAddressablesWithPlayerBuild: 2 + m_overridePlayerVersion: + m_GroupAssets: + - {fileID: 11400000, guid: 8b5ee8ae1bae6794692e05c65f209650, type: 2} + m_BuildSettings: + m_CompileScriptsInVirtualMode: 0 + m_CleanupStreamingAssetsAfterBuilds: 1 + m_LogResourceManagerExceptions: 1 + m_BundleBuildPath: Temp/com.unity.addressables/AssetBundles + m_ProfileSettings: + m_Profiles: + - m_InheritedParent: + m_Id: 2056c22079b11ce478d338f3f85afa99 + m_ProfileName: Default + m_Values: + - m_Id: 4b5be2a9894728a48b3be114e9cab1d3 + m_Value: '[UnityEditor.EditorUserBuildSettings.activeBuildTarget]' + - m_Id: cd46b6cc1cd9bb3468de6ffa0c95ecc0 + m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]' + - m_Id: f61512461f3fbb64bb882a6af52b8090 + m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]' + - m_Id: f03d2a55457fa6e4f8d499c42217628e + m_Value: ServerData/[BuildTarget] + - m_Id: c379e54b5a3413b4e95ede99b7df5856 + m_Value: http://[PrivateIpAddress]:[HostingServicePort] + - m_Id: a55fd1d1cc0e2c54f8fc99fd45a015b6 + m_Value: ~PALLETBARCODE~ + - m_Id: ba16486fe6f55fd4fbf595bcaa8301dc + m_Value: 'PALLET_BARCODE:[PalletBarcode]:' + - m_Id: 8f6c7444a8c35a84aa1f5afd15b7b68c + m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]' + - m_Id: f8725ba8ca4660e4a9c94c64ccb97536 + m_Value: '[SLZ.Marrow.MarrowSDK.BUILT_PALLETS_NAME]' + - m_Id: f97bbac1d358e3b47a31bd05dd60fd33 + m_Value: '[PalletBuildPath]/[UnityEditor.EditorUserBuildSettings.activeBuildTarget]/[PalletBarcode]' + - m_Id: d936b3f7b661e3b4eac88aca85467faa + m_Value: '[PalletLoadPath]' + - m_Id: 2023158ce820b5e46b6902e85fc5ddda + m_Value: '[GameBuildPath]' + - m_Id: 641fa520f0cf9104eb3a4973a1e9aea2 + m_Value: '[PalletLoadPath]' + - m_InheritedParent: + m_Id: fbad295727b3dec49ba750485b9465e7 + m_ProfileName: Pallets + m_Values: + - m_Id: 4b5be2a9894728a48b3be114e9cab1d3 + m_Value: '[UnityEditor.EditorUserBuildSettings.activeBuildTarget]' + - m_Id: cd46b6cc1cd9bb3468de6ffa0c95ecc0 + m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]' + - m_Id: f61512461f3fbb64bb882a6af52b8090 + m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]' + - m_Id: f03d2a55457fa6e4f8d499c42217628e + m_Value: ServerData/[BuildTarget] + - m_Id: c379e54b5a3413b4e95ede99b7df5856 + m_Value: http://[PrivateIpAddress]:[HostingServicePort] + - m_Id: a55fd1d1cc0e2c54f8fc99fd45a015b6 + m_Value: ~PALLETBARCODE~ + - m_Id: ba16486fe6f55fd4fbf595bcaa8301dc + m_Value: 'PALLET_BARCODE:[PalletBarcode]:' + - m_Id: 8f6c7444a8c35a84aa1f5afd15b7b68c + m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]' + - m_Id: f8725ba8ca4660e4a9c94c64ccb97536 + m_Value: '[SLZ.Marrow.MarrowSDK.BUILT_PALLETS_NAME]' + - m_Id: f97bbac1d358e3b47a31bd05dd60fd33 + m_Value: '[PalletBuildPath]/[UnityEditor.EditorUserBuildSettings.activeBuildTarget]/[PalletBarcode]' + - m_Id: d936b3f7b661e3b4eac88aca85467faa + m_Value: '[PalletLoadPath]' + - m_Id: 2023158ce820b5e46b6902e85fc5ddda + m_Value: '[GameBuildPath]' + - m_Id: 641fa520f0cf9104eb3a4973a1e9aea2 + m_Value: '[PalletLoadPath]' + m_ProfileEntryNames: + - m_Id: 4b5be2a9894728a48b3be114e9cab1d3 + m_Name: BuildTarget + m_InlineUsage: 0 + - m_Id: cd46b6cc1cd9bb3468de6ffa0c95ecc0 + m_Name: Local.BuildPath + m_InlineUsage: 0 + - m_Id: f61512461f3fbb64bb882a6af52b8090 + m_Name: Local.LoadPath + m_InlineUsage: 0 + - m_Id: f03d2a55457fa6e4f8d499c42217628e + m_Name: Remote.BuildPath + m_InlineUsage: 0 + - m_Id: c379e54b5a3413b4e95ede99b7df5856 + m_Name: Remote.LoadPath + m_InlineUsage: 0 + - m_Id: a55fd1d1cc0e2c54f8fc99fd45a015b6 + m_Name: PalletBarcode + m_InlineUsage: 0 + - m_Id: ba16486fe6f55fd4fbf595bcaa8301dc + m_Name: PalletLoadPath + m_InlineUsage: 0 + - m_Id: 8f6c7444a8c35a84aa1f5afd15b7b68c + m_Name: GameBuildPath + m_InlineUsage: 0 + - m_Id: f8725ba8ca4660e4a9c94c64ccb97536 + m_Name: PalletBuildPath + m_InlineUsage: 0 + - m_Id: f97bbac1d358e3b47a31bd05dd60fd33 + m_Name: Pallet.BuildPath + m_InlineUsage: 0 + - m_Id: d936b3f7b661e3b4eac88aca85467faa + m_Name: Pallet.LoadPath + m_InlineUsage: 0 + - m_Id: 2023158ce820b5e46b6902e85fc5ddda + m_Name: Game Pallet.BuildPath + m_InlineUsage: 0 + - m_Id: 641fa520f0cf9104eb3a4973a1e9aea2 + m_Name: Game Pallet.LoadPath + m_InlineUsage: 0 + m_ProfileVersion: 1 + m_LabelTable: + m_LabelNames: + - default + m_SchemaTemplates: [] + m_GroupTemplateObjects: + - {fileID: 11400000, guid: 63c989be4f767464bbd2d29f27316786, type: 2} + - {fileID: 11400000, guid: 76efe2a1ad2f9f24fb9b02f794fd974d, type: 2} + - {fileID: 11400000, guid: af5933cee8a8f9140889c4a0a669a67d, type: 2} + m_InitializationObjects: [] + m_CertificateHandlerType: + m_AssemblyName: + m_ClassName: + m_ActivePlayerDataBuilderIndex: 4 + m_DataBuilders: + - {fileID: 11400000, guid: 3aaba9eb0090cbd43bda0b87dae007ad, type: 2} + - {fileID: 11400000, guid: 2cf32c6dca5c3814aa682f35cb5afdb1, type: 2} + - {fileID: 11400000, guid: 70bd1540f4e4b0f4fa920d3ba706e290, type: 2} + - {fileID: 11400000, guid: 529af1d9b97831944b46774fd6d973d0, type: 2} + - {fileID: 11400000, guid: d2953db3a3b7d444b88a0af7383ae15b, type: 2} + - {fileID: 11400000, guid: 53d1aec21bc407e46951276825cdb752, type: 2} + m_ActiveProfileId: fbad295727b3dec49ba750485b9465e7 + m_HostingServicesManager: + m_HostingServiceInfos: [] + m_Settings: {fileID: 0} + m_NextInstanceId: 0 + m_RegisteredServiceTypeRefs: [] + m_PingTimeoutInMilliseconds: 5000 diff --git a/Assets/AddressableAssetsData/AddressableAssetSettings.asset.meta b/Assets/AddressableAssetsData/AddressableAssetSettings.asset.meta new file mode 100644 index 0000000..ea2fbe5 --- /dev/null +++ b/Assets/AddressableAssetsData/AddressableAssetSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c71f1176531903748ae728e24f577c88 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AddressableAssetsData/DefaultObject.asset b/Assets/AddressableAssetsData/DefaultObject.asset new file mode 100644 index 0000000..17432c2 --- /dev/null +++ b/Assets/AddressableAssetsData/DefaultObject.asset @@ -0,0 +1,15 @@ +%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: 3a189bb168d8d90478a09ea08c2f3d72, type: 3} + m_Name: DefaultObject + m_EditorClassIdentifier: + m_AddressableAssetSettingsGuid: c71f1176531903748ae728e24f577c88 diff --git a/Assets/AddressableAssetsData/DefaultObject.asset.meta b/Assets/AddressableAssetsData/DefaultObject.asset.meta new file mode 100644 index 0000000..a05c095 --- /dev/null +++ b/Assets/AddressableAssetsData/DefaultObject.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5d3b04119e4ec0946b0ce1ca71f2e9b7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders.meta b/Assets/SLZShaders.meta new file mode 100644 index 0000000..6a4cc47 --- /dev/null +++ b/Assets/SLZShaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 074f63f6bee531747b8047d59069bad1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/.GUIDList.txt b/Assets/SLZShaders/.GUIDList.txt new file mode 100644 index 0000000..ebb6fbc --- /dev/null +++ b/Assets/SLZShaders/.GUIDList.txt @@ -0,0 +1,39 @@ +e95b31b7241745c479b6b9574209d1f9 +6bf3d81d08a4ff343b22619a187bb249 +4c21875978f9ed04d9edcf6d97e9ed54 +b2e867ce46fe95046aaceb0155a651ad +f71cd8ed99405284ab09d18bf11d03ab +44cd4284ecfc46c4c97f571b3681e0c6 +ae467daa42d17ee45b6947a14ec8ec96 +7276a03ae0651b1419b50e2c76272732 +f05a5c6a2a705054d8547ebd87b58073 +97791a0150e87a14bbe1a5d46267be8a +93a4eb99edd7b9c42bfb913f0ee52b3e +4a1250fb7f0da2e4e96bd2e34ce4a8ea +24617ef4b8ecbe74984e0955867cffd4 +a0cae63ef60b7da4f9cb90b8cdb4ce4e +86c42a8335fb06241a674530f1fa24c5 +6aab105c75192124887c893201ce93e0 +225aec2e7a259b642a9fa1a4d10d7aac +c96b15076e0088349a95505e52f5a12a +93c33570d60341c439e50150832c5173 +81cc8fbe3bd52d149b2b91936b92bfb8 +6dc78741d54741a4c90a0fb74bd75f20 +3190a336b6bd4484d911017dd0fc15ba +ebf91ac3a3d63fe42ace3e3a75c5153a +57dc2f6a8812542439eb1e60c355d9a2 +75ebf02c7324c2944904e47c12cb421b +e48b7c1f5379ceb4687833196130a9dd +0e6e0041457dfeb47936aa37f7c4bfdf +75872890b046c074fac20ab6d18e52b1 +40dd6881c3760054cacc50fdba7554dc +36686d6671a56b04f9401216e0ff9ae5 +c156fe6f1c50d864f8ceb85b935236f7 +390d76c4ec3c32e4e8ecc2b49aa78a1c +005850956c06e3c4d9126500376c9a40 +88f1b8e9d502e19419d88bca2cab94da +2313d59684d119840a78fee73c48959a +2df13d630bf74324fbefa9003b6544b3 +03859193eb793184ca8cc47738d7109d +f42ab72a6a8465649be290d03a8f1981 +2a6fc1acbba5a6045a0692bfb9a7a8f2 diff --git a/Assets/SLZShaders/.sample.json b/Assets/SLZShaders/.sample.json new file mode 100644 index 0000000..de340c3 --- /dev/null +++ b/Assets/SLZShaders/.sample.json @@ -0,0 +1,5 @@ +{ + "displayName":"SLZ Bonelab Shaders", + "description": "A collection of shaders that are found in Bonelab", + "createSeparatePackage": false +} \ No newline at end of file diff --git a/Assets/SLZShaders/BonelabSky.meta b/Assets/SLZShaders/BonelabSky.meta new file mode 100644 index 0000000..d3e071c --- /dev/null +++ b/Assets/SLZShaders/BonelabSky.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 788eda7870482d742ab84d912eeaef30 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/README.txt b/Assets/SLZShaders/BonelabSky/README.txt new file mode 100644 index 0000000..95ff5b8 --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/README.txt @@ -0,0 +1,13 @@ +# Sky Prefab For Bonelab + +This package contains a prefab for rendering sky in Bonelab. Unity's default +sky rendering is turned off due to it being incompatible with the fog and vol- +umetric systems we use. The included prefab can be used as a replacement for +the default sky. The prefab is simply an enormous mesh with no occlusion and +a special shader. Note that the included shader (SLZ/Sky With Fog) must only be +used with the included mesh (Sky_Mesh) as the shader expects a single triangle +mesh. Additionally, Sky_Mesh has a 65x65x65 kilometer bounding box to ensure it +is always rendered. The included prefab further has dynamic occlusion disabled +to ensure it never gets culled, as well as all unnecessary lighting information +disabled. Do not enable the Occluder or Occludee Static flags on the prefab to +ensure the mesh is never occluded. diff --git a/Assets/SLZShaders/BonelabSky/README.txt.meta b/Assets/SLZShaders/BonelabSky/README.txt.meta new file mode 100644 index 0000000..acebe2e --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/README.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 86c42a8335fb06241a674530f1fa24c5 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/materials.meta b/Assets/SLZShaders/BonelabSky/materials.meta new file mode 100644 index 0000000..d447e23 --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d52f8debff15ed04b89c365c5b348eb0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/materials/Sky_Example.mat b/Assets/SLZShaders/BonelabSky/materials/Sky_Example.mat new file mode 100644 index 0000000..beedf14 --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/materials/Sky_Example.mat @@ -0,0 +1,94 @@ +%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: Sky_Example + m_Shader: {fileID: 4800000, guid: 75ebf02c7324c2944904e47c12cb421b, 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: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SkyTex: + m_Texture: {fileID: 8900000, guid: e48b7c1f5379ceb4687833196130a9dd, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _Blend: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DetailSmoothnessMapScale: 1 + - _DstBlend: 0 + - _FogDist: 0.1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OffsetFactor: 0 + - _OffsetUnits: 0 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 1 + - _SrcBlend: 1 + - _Surface: 0 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SkyColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/SLZShaders/BonelabSky/materials/Sky_Example.mat.meta b/Assets/SLZShaders/BonelabSky/materials/Sky_Example.mat.meta new file mode 100644 index 0000000..1e071d1 --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/materials/Sky_Example.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3190a336b6bd4484d911017dd0fc15ba +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/meshes.meta b/Assets/SLZShaders/BonelabSky/meshes.meta new file mode 100644 index 0000000..8faec6e --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/meshes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c33eff4ea614ba4285462f29506cf94 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/meshes/Sky_Mesh.asset b/Assets/SLZShaders/BonelabSky/meshes/Sky_Mesh.asset new file mode 100644 index 0000000..05c0224 --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/meshes/Sky_Mesh.asset @@ -0,0 +1,167 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!43 &4300000 +Mesh: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Sky_Mesh + serializedVersion: 11 + m_SubMeshes: + - serializedVersion: 2 + firstByte: 0 + indexCount: 3 + topology: 0 + baseVertex: 0 + firstVertex: 0 + vertexCount: 3 + localAABB: + m_Center: {x: 1, y: 1, z: 0} + m_Extent: {x: 2, y: 2, z: 0} + m_Shapes: + vertices: [] + shapes: [] + channels: [] + fullWeights: [] + m_BindPose: [] + m_BoneNameHashes: + m_RootBoneNameHash: 0 + m_BonesAABB: [] + m_VariableBoneCountWeights: + m_Data: + m_MeshCompression: 0 + m_IsReadable: 1 + m_KeepVertices: 1 + m_KeepIndices: 1 + m_IndexFormat: 0 + m_IndexBuffer: 000001000200 + m_VertexData: + serializedVersion: 3 + m_VertexCount: 3 + m_Channels: + - stream: 0 + offset: 0 + format: 0 + dimension: 3 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 12 + format: 0 + dimension: 2 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + m_DataSize: 60 + _typelessdata: 000080bf0000404000000000000000000000803f000080bf000080bf00000000000000000000000000004040000080bf000000000000803f00000000 + m_CompressedMesh: + m_Vertices: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_UV: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_Normals: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_Tangents: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_Weights: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_NormalSigns: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_TangentSigns: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_FloatColors: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_BoneIndices: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_Triangles: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_UVInfo: 0 + m_LocalAABB: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 32768, y: 32768, z: 32768} + m_MeshUsageFlags: 0 + m_CookingOptions: 30 + m_BakedConvexCollisionMesh: + m_BakedTriangleCollisionMesh: + m_MeshMetrics[0]: 1 + m_MeshMetrics[1]: 1 + m_MeshOptimizationFlags: 1 + m_StreamData: + serializedVersion: 2 + offset: 0 + size: 0 + path: diff --git a/Assets/SLZShaders/BonelabSky/meshes/Sky_Mesh.asset.meta b/Assets/SLZShaders/BonelabSky/meshes/Sky_Mesh.asset.meta new file mode 100644 index 0000000..3717f5c --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/meshes/Sky_Mesh.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ebf91ac3a3d63fe42ace3e3a75c5153a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/prefabs.meta b/Assets/SLZShaders/BonelabSky/prefabs.meta new file mode 100644 index 0000000..c1350f4 --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dfda820ea5fa26a4fad111042abd4a98 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/prefabs/Sky_Prefab.prefab b/Assets/SLZShaders/BonelabSky/prefabs/Sky_Prefab.prefab new file mode 100644 index 0000000..9dd83a8 --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/prefabs/Sky_Prefab.prefab @@ -0,0 +1,85 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &531086027732950538 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1713422862066233390} + - component: {fileID: 2453626235171082250} + - component: {fileID: 3742906364795765522} + m_Layer: 0 + m_Name: Sky_Prefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 64 + m_IsActive: 1 +--- !u!4 &1713422862066233390 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 531086027732950538} + 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: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &2453626235171082250 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 531086027732950538} + m_Mesh: {fileID: 4300000, guid: ebf91ac3a3d63fe42ace3e3a75c5153a, type: 2} +--- !u!23 &3742906364795765522 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 531086027732950538} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_DynamicOccludee: 0 + m_StaticShadowCaster: 0 + m_MotionVectors: 2 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 3190a336b6bd4484d911017dd0fc15ba, 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} diff --git a/Assets/SLZShaders/BonelabSky/prefabs/Sky_Prefab.prefab.meta b/Assets/SLZShaders/BonelabSky/prefabs/Sky_Prefab.prefab.meta new file mode 100644 index 0000000..bcd4a2a --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/prefabs/Sky_Prefab.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 57dc2f6a8812542439eb1e60c355d9a2 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/shaders.meta b/Assets/SLZShaders/BonelabSky/shaders.meta new file mode 100644 index 0000000..72c6e7b --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ca716302fae88144cb8018d9ea2dd61c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/shaders/Sky_Far.shader b/Assets/SLZShaders/BonelabSky/shaders/Sky_Far.shader new file mode 100644 index 0000000..3b051af --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/shaders/Sky_Far.shader @@ -0,0 +1,122 @@ +Shader "SLZ/Sky With Fog" +{ + Properties + { + _SkyTex ("Sky Texture", CUBE) = "black" {} + [HDR] _SkyColor ("Sky Color", Color) = (1,1,1,1) + _FogDist ("Fog Max Distance (0 to camera far clip)", Range(0,1)) = 1.0 + } + SubShader + { + Tags {"RenderPipeline" = "UniversalPipeline" "RenderType" = "Opaque" "Queue" = "AlphaTest+51" "IgnoreProjector"="True"} + Blend One Zero + ZWrite Off + ZTest LEqual + //Offset 1,1 + ColorMask RGBA + LOD 100 + Cull Off + + Pass + { + Name "Forward" + Tags {"Lightmode"="UniversalForward"} + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag +#pragma exclude_renderers gles + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fragment _ FOG_LINEAR FOG_EXP2 + #define SHADERPASS SHADERPASS_FORWARD + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.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.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.core/ShaderLibrary/Packing.hlsl" + + + struct appdata + { + //float4 vertex : POSITION; + half2 uv0 : TEXCOORD0; + uint vertexID : SV_VertexID; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float4 vertex : SV_POSITION; + float2 uv0 : TEXCOORD0; + float4 wPos_xyz_fog_x : TEXCOORD1; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + TEXTURECUBE(_SkyTex); + SamplerState sampler_SkyTex; + CBUFFER_START(UnityPerMaterial) + half4 _SkyColor; + float _FogDist; + CBUFFER_END + + + /* Gets the position of a vertex as a part of a right triangle that completely covers the screen + * Assumes a single triangle mesh, with the positions based on the vertex's ID. + * CCW order + * 0 : 0,1 0 + * 1 : 0,0 | \ + * 2 : 1,0 1--2 + */ + float4 GetQuadVertexPosition2(uint vertexID, float z = UNITY_NEAR_CLIP_VALUE) + { + uint topBit = vertexID >> 1u; + uint botBit = (vertexID & 1u); + float y = 1.0f - ((vertexID & 2u) >> 1); + float x = (vertexID & 1u);//1 - (topBit + botBit) & 1; // produces 1 for indices 0,3 and 0 for 1,2 + return float4(x, y, z, 1.0); + } + v2f vert(appdata v) + { + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + //float z = (rcp(_SkyDist) - _ZBufferParams.y) / (_ZBufferParams.x); // Transform from linear 0-1 depth to clipspace Z + float4 clipQuad = GetQuadVertexPosition(v.vertexID, UNITY_RAW_FAR_CLIP_VALUE); + clipQuad.xy = 4.0f * clipQuad.xy - 1.0f; + //clipQuad.xy = 0.5f * clipQuad.xy - 0.5f; + float4 wPos = mul(UNITY_MATRIX_I_VP, clipQuad); + o.wPos_xyz_fog_x.xyz = wPos.xyz / wPos.w; + o.vertex = clipQuad; + half clipZ_0Far = lerp(_ProjectionParams.y, _ProjectionParams.z, _FogDist); + o.wPos_xyz_fog_x.w = unity_FogParams.x * clipZ_0Far; + return o; + } + + half4 frag(v2f i) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + + float3 viewDir = normalize(float3(i.wPos_xyz_fog_x.xyz - _WorldSpaceCameraPos)); + half4 col = SAMPLE_TEXTURECUBE_LOD(_SkyTex, sampler_SkyTex, viewDir, 0); + col *= _SkyColor; + + col.rgb = MixFog(col.rgb, viewDir, i.wPos_xyz_fog_x.w); + + col = Volumetrics(col, i.wPos_xyz_fog_x.xyz); + + return col; + } + ENDHLSL + } + } +} diff --git a/Assets/SLZShaders/BonelabSky/shaders/Sky_Far.shader.meta b/Assets/SLZShaders/BonelabSky/shaders/Sky_Far.shader.meta new file mode 100644 index 0000000..587bb44 --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/shaders/Sky_Far.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 75ebf02c7324c2944904e47c12cb421b +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/textures.meta b/Assets/SLZShaders/BonelabSky/textures.meta new file mode 100644 index 0000000..e19f79e --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ea399fb043d56334aa2576c57d9a4eee +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/BonelabSky/textures/ProtoSky.png b/Assets/SLZShaders/BonelabSky/textures/ProtoSky.png new file mode 100644 index 0000000..84b95c3 Binary files /dev/null and b/Assets/SLZShaders/BonelabSky/textures/ProtoSky.png differ diff --git a/Assets/SLZShaders/BonelabSky/textures/ProtoSky.png.meta b/Assets/SLZShaders/BonelabSky/textures/ProtoSky.png.meta new file mode 100644 index 0000000..98eb217 --- /dev/null +++ b/Assets/SLZShaders/BonelabSky/textures/ProtoSky.png.meta @@ -0,0 +1,138 @@ +fileFormatVersion: 2 +guid: e48b7c1f5379ceb4687833196130a9dd +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + 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: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 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: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: "\r\n\r\n + false\r\n true\r\n + GenRoughness\r\n 1\r\n + false\r\n" + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Fluorescence.shader b/Assets/SLZShaders/Fluorescence.shader new file mode 100644 index 0000000..56d7f42 --- /dev/null +++ b/Assets/SLZShaders/Fluorescence.shader @@ -0,0 +1,3325 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/Fluorescence" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [ASEBegin]_BaseMap("Base Map", 2D) = "white" {} + [NoScaleOffset]_Fluorescence("Fluorescence", 2D) = "white" {} + _AlbedotoFluorescence("Albedo to Fluorescence", Range( 0 , 1)) = 1 + _FluorescenceTint("Fluorescence Tint", Color) = (1,1,1,1) + _Absorbance("Absorbance", Color) = (0,0.1875,0.929,1) + [NoScaleOffset]_MetallicGlossMap("MAS", 2D) = "white" {} + [NoScaleOffset][Normal]_BumpMap("Normal map", 2D) = "bump" {} + [NoScaleOffset]_EmissionMap("EmissionMap", 2D) = "black" {} + [HDR]_EmissionColor("EmissionColor", Color) = (0,0,0,0) + [Space(30)][Header(Details)][Space(10)][Toggle(_DETAILS_ON)] _Details("Details enabled", Float) = 0 + _DetailMap("DetailMap", 2D) = "white" {} + [ASEEnd]_EmissionFalloff("EmissionFalloff", Float) = 1 + + [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) = "" {} + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + + + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" } + Cull Back + ZWrite On + ZTest LEqual + Offset 0 , 0 + AlphaToMask Off + + HLSLINCLUDE + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForwardOnly" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_FORWARD + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.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.core/ShaderLibrary/TextureStack.hlsl" + + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + #define ASE_NEEDS_FRAG_WORLD_TANGENT + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_BITANGENT + #pragma shader_feature_local_fragment _DETAILS_ON + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.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.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _DetailMap_ST; + float4 _EmissionColor; + float4 _FluorescenceTint; + float4 _Absorbance; + float _AlbedotoFluorescence; + float _EmissionFalloff; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + TEXTURE2D(_DetailMap); + SAMPLER(sampler_DetailMap); + TEXTURE2D(_Fluorescence); + SAMPLER(sampler_Fluorescence); + TEXTURE2D(_BumpMap); + SAMPLER(sampler_BumpMap); + TEXTURE2D(_EmissionMap); + SAMPLER(sampler_EmissionMap); + TEXTURE2D(_MetallicGlossMap); + SAMPLER(sampler_MetallicGlossMap); + + + float MyCustomExpression17( float smooth1, float smooth2 ) + { + return saturate( smooth1 + smooth2 - 1); + } + + inline float MyCustomExpression217_g1( float detailSmooth, float smoothness ) + { + return smoothness * (2.0 * detailSmooth); + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + #endif + + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) || defined(ASE_TERRAIN_INSTANCING) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 uv_BaseMap = IN.ase_texcoord8.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float4 temp_output_21_0_g1 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ); + float4 temp_output_109_0_g170 = round( temp_output_21_0_g1 ); + float2 texCoord219_g1 = IN.ase_texcoord8.xy * float2( 1,1 ) + float2( 0,0 ); + float2 temp_output_218_0_g1 = texCoord219_g1; + float4 tex2DNode1_g1 = SAMPLE_TEXTURE2D( _DetailMap, sampler_DetailMap, ( ( temp_output_218_0_g1 * _DetailMap_ST.xy ) + _DetailMap_ST.zw ) ); + #ifdef _DETAILS_ON + float4 staticSwitch16_g1 = ( ( temp_output_109_0_g170 * ( 1.0 - ( ( 1.0 - temp_output_21_0_g1 ) * ( 1.0 - (tex2DNode1_g1.r).xxxx ) * 2.0 ) ) ) + ( ( 1.0 - temp_output_109_0_g170 ) * ( temp_output_21_0_g1 * (tex2DNode1_g1.r).xxxx * 2.0 ) ) ); + #else + float4 staticSwitch16_g1 = temp_output_21_0_g1; + #endif + float4 temp_output_16_0 = staticSwitch16_g1; + float4 tex2DNode14 = SAMPLE_TEXTURE2D( _Fluorescence, sampler_Fluorescence, uv_BaseMap ); + float4 lerpResult24 = lerp( temp_output_16_0 , float4( 0,0,0,0 ) , ( _AlbedotoFluorescence * tex2DNode14 )); + + float3 tex2DNode11 = UnpackNormalScale( SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, uv_BaseMap ), 1.0f ); + float4 temp_output_22_0_g1 = float4( tex2DNode11 , 0.0 ); + float2 temp_output_57_0_g1 = (tex2DNode1_g1).ga; + float2 break79_g1 = temp_output_57_0_g1; + float3 appendResult56_g1 = (float3(break79_g1.y , break79_g1.x , 1.0)); + float3 temp_cast_5 = (1.0).xxx; + #ifdef _DETAILS_ON + float4 staticSwitch26_g1 = float4( BlendNormal( temp_output_22_0_g1.rgb , ( ( appendResult56_g1 * 2.0 ) - temp_cast_5 ) ) , 0.0 ); + #else + float4 staticSwitch26_g1 = temp_output_22_0_g1; + #endif + float4 temp_output_16_25 = staticSwitch26_g1; + + float4 tex2DNode27 = SAMPLE_TEXTURE2D( _EmissionMap, sampler_EmissionMap, uv_BaseMap ); + float3 tanToWorld0 = float3( WorldTangent.x, WorldBiTangent.x, WorldNormal.x ); + float3 tanToWorld1 = float3( WorldTangent.y, WorldBiTangent.y, WorldNormal.y ); + float3 tanToWorld2 = float3( WorldTangent.z, WorldBiTangent.z, WorldNormal.z ); + float3 tanNormal38 = temp_output_16_25.rgb; + float3 worldNormal38 = float3(dot(tanToWorld0,tanNormal38), dot(tanToWorld1,tanNormal38), dot(tanToWorld2,tanNormal38)); + float dotResult31 = dot( WorldViewDirection , worldNormal38 ); + + float4 tex2DNode12 = SAMPLE_TEXTURE2D( _MetallicGlossMap, sampler_MetallicGlossMap, uv_BaseMap ); + + float smooth117 = tex2DNode11.b; + float smooth217 = tex2DNode12.b; + float localMyCustomExpression17 = MyCustomExpression17( smooth117 , smooth217 ); + float temp_output_23_0_g1 = localMyCustomExpression17; + float detailSmooth217_g1 = tex2DNode1_g1.b; + float smoothness217_g1 = temp_output_23_0_g1; + float localMyCustomExpression217_g1 = MyCustomExpression217_g1( detailSmooth217_g1 , smoothness217_g1 ); + #ifdef _DETAILS_ON + float staticSwitch17_g1 = localMyCustomExpression217_g1; + #else + float staticSwitch17_g1 = temp_output_23_0_g1; + #endif + + float4 lerpResult20 = lerp( float4( 1,1,1,1 ) , temp_output_16_0 , _AlbedotoFluorescence); + + float3 Albedo = lerpResult24.rgb; + float3 Normal = temp_output_16_25.rgb; + float3 Emission = ( tex2DNode27 * _EmissionColor * temp_output_16_0 * saturate( pow( dotResult31 , _EmissionFalloff ) ) ).rgb; +#if 0 + float3 BakedEmission = ( tex2DNode27 * _EmissionColor * temp_output_16_0 ).rgb; +#endif + float3 Specular = 0.5; + float Metallic = tex2DNode12.r; + float Smoothness = staticSwitch17_g1; + float Occlusion = tex2DNode12.g; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _CLEARCOAT + float CoatMask = 0; + float CoatSmoothness = 0; + #endif + + #if defined(_FLUORESCENCE) + float4 Fluorescence = ( tex2DNode14 * _FluorescenceTint * lerpResult20 ); + float4 Absorbance = _Absorbance; + #endif + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = ShadowCoords; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + + #ifdef ASE_FOG + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzww; //TODO: Shuffle things in vertex streams so we get full RGBA color rather than RGBB here + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xyz, IN.dynamicLightmapUV.xy, IN.vertexSH, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, IN.vertexSH , inputData.normalWS); + #endif + + #else + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + #endif + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = Albedo; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + #if defined(_FLUORESCENCE) + surfaceData.fluorescence = Fluorescence; + surfaceData.absorbance = Absorbance; + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData); + #endif + + half4 color = UniversalFragmentPBR( inputData, surfaceData); + + #ifdef LIGHTMAP_ON + float3 MetalSpec = lerp(kDieletricSpec.rgb, surfaceData.albedo , surfaceData.metallic); + color.rgb += BakedSpecular * surfaceData.occlusion * MetalSpec * inputData.bakedGI.rgb; + #endif + + #ifdef _TRANSMISSION_ASE + { + float shadow = _TransmissionShadow; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; + color.rgb += Albedo * mainTransmission; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; + color.rgb += Albedo * transmission; + } + #endif + } + #endif + + #ifdef _TRANSLUCENCY_ASE + { + float shadow = _TransShadow; + float normal = _TransNormal; + float scattering = _TransScattering; + float direct = _TransDirect; + float ambient = _TransAmbient; + float strength = _TransStrength; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + + half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; + half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); + half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * mainTranslucency * strength; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 lightDir = light.direction + inputData.normalWS * normal; + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * translucency * strength; + } + #endif + } + #endif + + #ifdef _REFRACTION_ASE + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, IN.fogFactorAndVertexLight.x); + #endif + #endif + + color = Volumetrics( color, inputData.positionWS); + + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return color; + } + + ENDHLSL + } + + + Pass + { + + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _DetailMap_ST; + float4 _EmissionColor; + float4 _FluorescenceTint; + float4 _Absorbance; + float _AlbedotoFluorescence; + float _EmissionFalloff; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + float3 _LightDirection; + float3 _LightPosition; + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + float3 normalWS = TransformObjectToWorldDir(v.ase_normal); + + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + float2 vShadowOffsets = GetShadowOffsets( normalWS, lightDirectionWS ); + positionWS.xyz -= vShadowOffsets.y * lightDirectionWS.xyz * .01; + float4 clipPos = TransformObjectToHClip( float4( mul( unity_WorldToObject, float4( positionWS.xyz, 1.0 ) ).xyz, 1.0 ) ); + //float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + #if UNITY_REVERSED_Z + clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #else + clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #endif + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = clipPos; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + return 0; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _DetailMap_ST; + float4 _EmissionColor; + float4 _FluorescenceTint; + float4 _Absorbance; + float _AlbedotoFluorescence; + float _EmissionFalloff; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + + Pass + { + + Name "Meta" + Tags { "LightMode"="Meta" } + + Cull Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature _ EDITOR_VISUALIZATION + + #define SHADERPASS SHADERPASS_META + + #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/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #pragma shader_feature_local_fragment _DETAILS_ON + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef EDITOR_VISUALIZATION + float4 VizUV : TEXCOORD2; + float4 LightCoord : TEXCOORD3; + #endif + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _DetailMap_ST; + float4 _EmissionColor; + float4 _FluorescenceTint; + float4 _Absorbance; + float _AlbedotoFluorescence; + float _EmissionFalloff; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + TEXTURE2D(_DetailMap); + SAMPLER(sampler_DetailMap); + TEXTURE2D(_Fluorescence); + SAMPLER(sampler_Fluorescence); + TEXTURE2D(_EmissionMap); + SAMPLER(sampler_EmissionMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord4.xy = v.texcoord0.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.clipPos = MetaVertexPosition( v.vertex, v.texcoord1.xy, v.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); + + #ifdef EDITOR_VISUALIZATION + float2 VizUV = 0; + float4 LightCoord = 0; + UnityEditorVizData(v.vertex.xyz, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, VizUV, LightCoord); + o.VizUV = float4(VizUV, 0, 0); + o.LightCoord = LightCoord; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = o.clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 uv_BaseMap = IN.ase_texcoord4.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float4 temp_output_21_0_g1 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ); + float4 temp_output_109_0_g170 = round( temp_output_21_0_g1 ); + float2 texCoord219_g1 = IN.ase_texcoord4.xy * float2( 1,1 ) + float2( 0,0 ); + float2 temp_output_218_0_g1 = texCoord219_g1; + float4 tex2DNode1_g1 = SAMPLE_TEXTURE2D( _DetailMap, sampler_DetailMap, ( ( temp_output_218_0_g1 * _DetailMap_ST.xy ) + _DetailMap_ST.zw ) ); + #ifdef _DETAILS_ON + float4 staticSwitch16_g1 = ( ( temp_output_109_0_g170 * ( 1.0 - ( ( 1.0 - temp_output_21_0_g1 ) * ( 1.0 - (tex2DNode1_g1.r).xxxx ) * 2.0 ) ) ) + ( ( 1.0 - temp_output_109_0_g170 ) * ( temp_output_21_0_g1 * (tex2DNode1_g1.r).xxxx * 2.0 ) ) ); + #else + float4 staticSwitch16_g1 = temp_output_21_0_g1; + #endif + float4 temp_output_16_0 = staticSwitch16_g1; + float4 tex2DNode14 = SAMPLE_TEXTURE2D( _Fluorescence, sampler_Fluorescence, uv_BaseMap ); + float4 lerpResult24 = lerp( temp_output_16_0 , float4( 0,0,0,0 ) , ( _AlbedotoFluorescence * tex2DNode14 )); + + float4 tex2DNode27 = SAMPLE_TEXTURE2D( _EmissionMap, sampler_EmissionMap, uv_BaseMap ); + + + float3 Albedo = lerpResult24.rgb; + float3 Emission = ( tex2DNode27 * _EmissionColor * temp_output_16_0 ).rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = Albedo; + metaInput.Emission = Emission; + #ifdef EDITOR_VISUALIZATION + metaInput.VizUV = IN.VizUV.xy; + metaInput.LightCoord = IN.LightCoord; + #endif + + return MetaFragment(metaInput); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "BakedRaytrace" + Tags{ "LightMode" = "BakedRaytrace" } + HLSLPROGRAM + + /*ase_pragma_before*/ + + #define SHADERPASS SHADERPASS_RAYTRACE + + #include "UnityRaytracingMeshUtils.cginc" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #define _EMISSION + #pragma raytracing test + #pragma shader_feature_local __ _ALBEDOMULTIPLY_ON + #pragma shader_feature_local __ _EMISSION_ON + + /*ase_pragma*/ + + struct RayPayload + { + float4 color; + float3 dir; + }; + + struct AttributeData + { + float2 barycentrics; + }; + + struct Vertex + { + float2 texcoord; + float3 normal; + }; + + Texture2D _BaseMap; + SamplerState sampler_BaseMap; + + CBUFFER_START( UnityPerMaterial ) + /*ase_srp_batcher*/ + Texture2D _EmissionMap; + SamplerState sampler_EmissionMap; + + float4 _EmissionColor; + float4 _BaseMap_ST; + float _BakedMutiplier = 1; + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + //https://coty.tips/raytracing-in-unity/ + [shader("closesthit")] + void MyClosestHit(inout RayPayload payload, + AttributeData attributes : SV_IntersectionAttributes) { + + payload.color = float4(0,0,0,1); //Intializing + payload.dir = float3(1,0,0); + + // #if _EMISSION_ON + uint2 launchIdx = DispatchRaysIndex(); + // ShadingData shade = getShadingData( PrimitiveIndex(), attribs ); + + uint primitiveIndex = PrimitiveIndex(); + uint3 triangleIndicies = UnityRayTracingFetchTriangleIndices(primitiveIndex); + Vertex v0, v1, v2; + + v0.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.x, kVertexAttributeTexCoord0); + v1.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.y, kVertexAttributeTexCoord0); + v2.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.z, kVertexAttributeTexCoord0); + + // v0.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.x, kVertexAttributeNormal); + // v1.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.y, kVertexAttributeNormal); + // v2.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.z, kVertexAttributeNormal); + + float3 barycentrics = float3(1.0 - attributes.barycentrics.x - attributes.barycentrics.y, attributes.barycentrics.x, attributes.barycentrics.y); + + Vertex vInterpolated; + vInterpolated.texcoord = v0.texcoord * barycentrics.x + v1.texcoord * barycentrics.y + v2.texcoord * barycentrics.z; + //TODO: Extract normal direction to ignore the backside of emissive objects + //vInterpolated.normal = v0.normal * barycentrics.x + v1.normal * barycentrics.y + v2.normal * barycentrics.z; + // if ( dot(vInterpolated.normal, float3(1,0,0) < 0) ) payload.color = float4(0,10,0,1) ; + // else payload.color = float4(10,0,0,1) ; + + //TODO: Figure out how to tie Amplify into using Texture2d and SamplerState instead of the bundled sampler2D. Forcing names for now. + //#if _ALBEDOMULTIPLY_ON + float4 albedo = float4(_BaseMap.SampleLevel(sampler_BaseMap, vInterpolated.texcoord.xy * _BaseMap_ST.xy + _BaseMap_ST.zw, 0 ).rgb , 1) ; + // #else + // float4 albedo = float4(1,1,1,1); + // #endif + + payload.color = float4( (_EmissionMap.SampleLevel(sampler_EmissionMap, vInterpolated.texcoord * _BaseMap_ST.xy + _BaseMap_ST.zw,0) ).rgb * _EmissionColor.rgb * albedo.rgb * _BakedMutiplier , 1 ); + // #else + // payload.color = float4(0,0,0,1); + + // #endif + } + ENDHLSL + + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend One Zero, One Zero + ColorMask RGBA + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_2D + + #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" + + #pragma shader_feature_local_fragment _DETAILS_ON + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_texcoord2 : TEXCOORD2; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _DetailMap_ST; + float4 _EmissionColor; + float4 _FluorescenceTint; + float4 _Absorbance; + float _AlbedotoFluorescence; + float _EmissionFalloff; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + TEXTURE2D(_DetailMap); + SAMPLER(sampler_DetailMap); + TEXTURE2D(_Fluorescence); + SAMPLER(sampler_Fluorescence); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID( v ); + UNITY_TRANSFER_INSTANCE_ID( v, o ); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + o.ase_texcoord2.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord2.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 uv_BaseMap = IN.ase_texcoord2.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float4 temp_output_21_0_g1 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ); + float4 temp_output_109_0_g170 = round( temp_output_21_0_g1 ); + float2 texCoord219_g1 = IN.ase_texcoord2.xy * float2( 1,1 ) + float2( 0,0 ); + float2 temp_output_218_0_g1 = texCoord219_g1; + float4 tex2DNode1_g1 = SAMPLE_TEXTURE2D( _DetailMap, sampler_DetailMap, ( ( temp_output_218_0_g1 * _DetailMap_ST.xy ) + _DetailMap_ST.zw ) ); + #ifdef _DETAILS_ON + float4 staticSwitch16_g1 = ( ( temp_output_109_0_g170 * ( 1.0 - ( ( 1.0 - temp_output_21_0_g1 ) * ( 1.0 - (tex2DNode1_g1.r).xxxx ) * 2.0 ) ) ) + ( ( 1.0 - temp_output_109_0_g170 ) * ( temp_output_21_0_g1 * (tex2DNode1_g1.r).xxxx * 2.0 ) ) ); + #else + float4 staticSwitch16_g1 = temp_output_21_0_g1; + #endif + float4 temp_output_16_0 = staticSwitch16_g1; + float4 tex2DNode14 = SAMPLE_TEXTURE2D( _Fluorescence, sampler_Fluorescence, uv_BaseMap ); + float4 lerpResult24 = lerp( temp_output_16_0 , float4( 0,0,0,0 ) , ( _AlbedotoFluorescence * tex2DNode14 )); + + + float3 Albedo = lerpResult24.rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + half4 color = half4( Albedo, Alpha ); + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + return color; + } + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormalsOnly" } + + ZWrite On + Blend One Zero + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/Color.hlsl" + + #pragma shader_feature_local_fragment _DETAILS_ON + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _DetailMap_ST; + float4 _EmissionColor; + float4 _FluorescenceTint; + float4 _Absorbance; + float _AlbedotoFluorescence; + float _EmissionFalloff; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BumpMap); + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BumpMap); + TEXTURE2D(_DetailMap); + SAMPLER(sampler_DetailMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord4.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal( v.ase_normal ); + float4 tangentWS = float4(TransformObjectToWorldDir( v.ase_tangent.xyz), v.ase_tangent.w); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + float3 WorldNormal = IN.worldNormal; + float4 WorldTangent = IN.worldTangent; + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 uv_BaseMap = IN.ase_texcoord4.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float3 tex2DNode11 = UnpackNormalScale( SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, uv_BaseMap ), 1.0f ); + float4 temp_output_22_0_g1 = float4( tex2DNode11 , 0.0 ); + float2 texCoord219_g1 = IN.ase_texcoord4.xy * float2( 1,1 ) + float2( 0,0 ); + float2 temp_output_218_0_g1 = texCoord219_g1; + float4 tex2DNode1_g1 = SAMPLE_TEXTURE2D( _DetailMap, sampler_DetailMap, ( ( temp_output_218_0_g1 * _DetailMap_ST.xy ) + _DetailMap_ST.zw ) ); + float2 temp_output_57_0_g1 = (tex2DNode1_g1).ga; + float2 break79_g1 = temp_output_57_0_g1; + float3 appendResult56_g1 = (float3(break79_g1.y , break79_g1.x , 1.0)); + float3 temp_cast_2 = (1.0).xxx; + #ifdef _DETAILS_ON + float4 staticSwitch26_g1 = float4( BlendNormal( temp_output_22_0_g1.rgb , ( ( appendResult56_g1 * 2.0 ) - temp_cast_2 ) ) , 0.0 ); + #else + float4 staticSwitch26_g1 = temp_output_22_0_g1; + #endif + float4 temp_output_16_25 = staticSwitch26_g1; + + float3 Normal = temp_output_16_25.rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + return half4(packedNormalWS, 0.0); + #else + + #if defined(_NORMALMAP) + #if _NORMAL_DROPOFF_TS + float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz); + float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz)); + #elif _NORMAL_DROPOFF_OS + float3 normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + float3 normalWS = Normal; + #endif + #else + float3 normalWS = WorldNormal; + #endif + + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + #endif + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "GBuffer" + Tags{"LightMode" = "None" } + + Blend One Zero + ColorMask RGBA + /*ase_stencil*/ + + HLSLPROGRAM +/*ase_pragma_before*/ +#if FALSE + #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_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 _ _MIXED_LIGHTING_SUBTRACTIVE + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _GBUFFER_NORMALS_OCT + //#pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile _ _RENDER_PASS_ENABLED + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_GBUFFER + + #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/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + /*ase_pragma*/ + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;t=t;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + /*ase_interp(8,):sp=sp;sc=tc2;wn.xyz=tc3.xyz;wt.xyz=tc4.xyz;wbt.xyz=tc5.xyz;wp.x=tc3.w;wp.y=tc4.w;wp.z=tc5.w;spu=tc6*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + /*ase_srp_batcher*/ + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + /*ase_globals*/ + + /*ase_funcs*/ + + VertexOutput VertexFunction( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;8;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = /*ase_vert_out:Vertex Normal;Float3;10;-1;_Normal*/v.ase_normal/*end*/; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + /*ase_control_code:v=VertexInput;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;o=VertexInput;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + FragmentOutput frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + /*ase_frag_input*/ ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #else + ShadowCoords = float4(0, 0, 0, 0); + #endif + + + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + /*ase_frag_code:IN=VertexOutput*/ + float3 Albedo = /*ase_frag_out:Albedo;Float3;0;-1;_Albedo*/float3(0.5, 0.5, 0.5)/*end*/; + float3 Normal = /*ase_frag_out:Normal;Float3;1;-1;_FragNormal*/float3(0, 0, 1)/*end*/; + float3 Emission = /*ase_frag_out:Emission;Float3;2;-1;_Emission*/0/*end*/; + float3 Specular = /*ase_frag_out:Specular;Float3;9;-1;_Specular*/0.5/*end*/; + float Metallic = /*ase_frag_out:Metallic;Float;3;-1;_Metallic*/0/*end*/; + float Smoothness = /*ase_frag_out:Smoothness;Float;4;-1;_Smoothness*/0.5/*end*/; + float Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;6;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;7;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;16;-1;_AlphaClipShadow*/0.5/*end*/; + float3 BakedGI = /*ase_frag_out:Baked GI;Float3;11;-1;_BakedGI*/0/*end*/; + float3 RefractionColor = /*ase_frag_out:Refraction Color;Float3;12;-1;_RefractionColor*/1/*end*/; + float RefractionIndex = /*ase_frag_out:Refraction Index;Float;13;-1;_RefractionIndex*/1/*end*/; + float3 Transmission = /*ase_frag_out:Transmission;Float3;14;-1;_Transmission*/1/*end*/; + float3 Translucency = /*ase_frag_out:Translucency;Float3;15;-1;_Translucency*/1/*end*/; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/0/*end*/; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = IN.clipPos; + inputData.shadowCoord = ShadowCoords; + + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + #else + inputData.normalWS = WorldNormal; + #endif + + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + inputData.viewDirectionWS = SafeNormalize( WorldViewDirection ); + + + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(WorldPosition, 1.0), IN.fogFactorAndVertexLight.x); + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.clipPos, + Albedo, + Specular, + inputData.normalWS, + Metallic, + Occlusion, + Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData + (Albedo, Metallic, Specular, Smoothness, Alpha, brdfData); + + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + half4 color; + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + color.a = Alpha; + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _DetailMap_ST; + float4 _EmissionColor; + float4 _FluorescenceTint; + float4 _Absorbance; + float _AlbedotoFluorescence; + float _EmissionFalloff; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _DetailMap_ST; + float4 _EmissionColor; + float4 _FluorescenceTint; + float4 _Absorbance; + float _AlbedotoFluorescence; + float _EmissionFalloff; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphLitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +298;327;1906;1013;1833.764;333.6301;1;True;True +Node;AmplifyShaderEditor.SamplerNode;10;-601.7855,-199.5828;Inherit;True;Property;_BaseMap;Base Map;0;0;Create;False;0;0;0;False;0;False;-1;None;4a2e2c582c6152344b543594adcaf736;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SaturateNode;39;749.2825,908.504;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;19;-553.2972,522.168;Inherit;False;Property;_FluorescenceTint;Fluorescence Tint;3;0;Create;True;0;0;0;False;0;False;1,1,1,1;1,1,1,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;25;-129.8595,567.0112;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.RangedFloatNode;21;-555.801,439.5413;Inherit;False;Property;_AlbedotoFluorescence;Albedo to Fluorescence;2;0;Create;True;0;0;0;False;0;False;1;0;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;28;509.9995,658.6445;Inherit;False;Property;_EmissionColor;EmissionColor;8;1;[HDR];Create;True;0;0;0;False;0;False;0,0,0,0;0.1320755,0.1320755,0.1320755,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.ViewDirInputsCoordNode;30;108.8457,977.0601;Inherit;False;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.WorldNormalVector;38;88.84518,824.4688;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.DotProductOpNode;31;311.6371,952.2789;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;18;51.41707,346.4341;Inherit;True;3;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.ColorNode;15;-512.9699,897.4257;Inherit;False;Property;_Absorbance;Absorbance;4;0;Create;True;0;0;0;False;0;False;0,0.1875,0.929,1;0,0.1874999,0.929,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;36;347.6555,1260.693;Inherit;False;Property;_EmissionFalloff;EmissionFalloff;15;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.CustomExpressionNode;17;-277.2696,103.3686;Inherit;False;return saturate( smooth1 + smooth2 - 1)@;1;Create;2;True;smooth1;FLOAT;0;In;;Inherit;False;True;smooth2;FLOAT;0;In;;Inherit;False;My Custom Expression;True;False;0;;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;12;-598.5559,207.799;Inherit;True;Property;_MetallicGlossMap;MAS;5;1;[NoScaleOffset];Create;False;0;0;0;False;0;False;-1;None;132961454852db9449638c8ef0e57786;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.LerpOp;24;136.1732,67.49464;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.FunctionNode;16;-137.3702,-56.82171;Inherit;False;Detail Map;9;;1;c1327834c5e6d22468ff566e8f35a321;0;4;21;COLOR;1,1,1,1;False;22;COLOR;0,0,1,0;False;23;FLOAT;0.5;False;218;FLOAT2;0,0;False;3;COLOR;0;COLOR;25;FLOAT;24 +Node;AmplifyShaderEditor.PowerNode;34;539.2812,1028.813;Inherit;True;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.LerpOp;20;-113.0252,243.6415;Inherit;False;3;0;COLOR;1,1,1,1;False;1;COLOR;0,0,0,0;False;2;FLOAT;1;False;1;COLOR;0 +Node;AmplifyShaderEditor.SamplerNode;14;-596.6281,693.1221;Inherit;True;Property;_Fluorescence;Fluorescence;1;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;-1;None;0b3941e9220e3944a9b2cc23007a65c0;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SamplerNode;27;508.1717,448.9693;Inherit;True;Property;_EmissionMap;EmissionMap;7;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;-1;None;0b3941e9220e3944a9b2cc23007a65c0;True;0;False;black;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;29;888.4446,410.9026;Inherit;False;4;4;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SamplerNode;11;-599.349,7.815605;Inherit;True;Property;_BumpMap;Normal map;6;2;[NoScaleOffset];[Normal];Create;False;0;0;0;False;0;False;-1;None;7b90612d0f9d1664e803dca742b9ad46;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;35;891.5758,632.2701;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;13;-1235.268,20.01114;Inherit;False;0;10;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;3;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;2;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;9;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;6;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormalsOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;8;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;5;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;4;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;0;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;7;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;1;1265.567,48.64588;Half;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;SLZ/Fluorescence;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;23;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalForwardOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;48;Workflow;1;0;Surface;0;0; Refraction Model;0;0; Blend;0;0;Two Sided;1;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Transmission;0;0; Transmission Shadow;0.5,False,-1;0;Translucency;0;0; Translucency Strength;1,False,-1;0; Normal Distortion;0.5,False,-1;0; Scattering;2,False,-1;0; Direct;0.9,False,-1;0; Ambient;0.1,False,-1;0; Shadow;0.5,False,-1;0;Cast Shadows;1;0; Use Shadow Threshold;0;0;Receive Shadows;1;0;GPU Instancing;0;0;LOD CrossFade;0;0;Built-in Fog;1;0;Lightmaps;1;0;Volumetrics;1;0;Decals;0;0;Screen Space Occlusion;1;0;Reflection Probe Blend/Projection;1;0;Light Layers;0;0;_FinalColorxAlpha;0;0;Meta Pass;1;0;GBuffer Pass;0;0;Override Baked GI;0;0;Extra Pre Pass;0;0;DOTS Instancing;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Write Depth;0;0; Early Z;0;0;Vertex Position,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;0;0;Fluorescence;1;637956974339123413;0;10;False;True;True;True;True;True;True;False;True;True;False;;True;0 +WireConnection;10;1;13;0 +WireConnection;39;0;34;0 +WireConnection;25;0;21;0 +WireConnection;25;1;14;0 +WireConnection;38;0;16;25 +WireConnection;31;0;30;0 +WireConnection;31;1;38;0 +WireConnection;18;0;14;0 +WireConnection;18;1;19;0 +WireConnection;18;2;20;0 +WireConnection;17;0;11;3 +WireConnection;17;1;12;3 +WireConnection;12;1;13;0 +WireConnection;24;0;16;0 +WireConnection;24;2;25;0 +WireConnection;16;21;10;0 +WireConnection;16;22;11;0 +WireConnection;16;23;17;0 +WireConnection;34;0;31;0 +WireConnection;34;1;36;0 +WireConnection;20;1;16;0 +WireConnection;20;2;21;0 +WireConnection;14;1;13;0 +WireConnection;27;1;13;0 +WireConnection;29;0;27;0 +WireConnection;29;1;28;0 +WireConnection;29;2;16;0 +WireConnection;29;3;39;0 +WireConnection;11;1;13;0 +WireConnection;35;0;27;0 +WireConnection;35;1;28;0 +WireConnection;35;2;16;0 +WireConnection;1;0;24;0 +WireConnection;1;1;16;25 +WireConnection;1;2;29;0 +WireConnection;1;20;35;0 +WireConnection;1;3;12;1 +WireConnection;1;4;16;24 +WireConnection;1;5;12;2 +WireConnection;1;21;18;0 +WireConnection;1;22;15;0 +ASEEND*/ +//CHKSM=308FF68453A182A37D42E29F3590C47D31935B4E \ No newline at end of file diff --git a/Assets/SLZShaders/Fluorescence.shader.meta b/Assets/SLZShaders/Fluorescence.shader.meta new file mode 100644 index 0000000..ebc852e --- /dev/null +++ b/Assets/SLZShaders/Fluorescence.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: e95b31b7241745c479b6b9574209d1f9 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/ForceField.shader b/Assets/SLZShaders/ForceField.shader new file mode 100644 index 0000000..ad915bd --- /dev/null +++ b/Assets/SLZShaders/ForceField.shader @@ -0,0 +1,2397 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/ForceField" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) + [ASEBegin][HDR]_Color("Color", Color) = (1,1,1,0) + [HDR]_EdgeColor("Edge Color", Color) = (1,1,1,0) + _EdgeDistance("Edge Distance", Float) = 0.1 + _Normal("Normal", 2D) = "bump" {} + _NormalScale("Normal Scale", Float) = 1 + _TimeScaler("Time Scaler", Float) = 0 + _Vector0("Vector 0", Vector) = (1,1,0,0) + [ASEEnd]_NoiseDefusion("Noise Defusion", Float) = 0 + + [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) = "" {} + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Transparent" "Queue"="Transparent" } + + Cull Off + AlphaToMask Off + + HLSLINCLUDE + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma target 5.0 + + //#pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForwardOnly" } + + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZWrite Off + ZTest LEqual + Offset 0 , 0 + ColorMask RGBA + + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + #define REQUIRE_DEPTH_TEXTURE 1 + + + //#pragma multi_compile _ LIGHTMAP_ON + //#pragma multi_compile _ DIRLIGHTMAP_COMBINED + //#pragma shader_feature _ _SAMPLE_GI + //#pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + //#pragma multi_compile _ DEBUG_DISPLAY + #define SHADERPASS SHADERPASS_UNLIT + + + #pragma vertex vert + #pragma fragment frag + + #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/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl" + + + #define ASE_NEEDS_FRAG_WORLD_POSITION + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef ASE_FOG + float fogFactor : TEXCOORD2; + #endif + float4 ase_texcoord3 : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Vector0; + float4 _Color; + float4 _EdgeColor; + float _TimeScaler; + float _NormalScale; + float _NoiseDefusion; + float _EdgeDistance; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _Normal; + uniform float4 _CameraDepthTexture_TexelSize; + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g4( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + float3 MyCustomExpression1_g8( float2 uv, float level ) + { + return SAMPLE_TEXTURE2D_X_LOD(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, UnityStereoTransformScreenSpaceTex(uv),level).rgb; + } + + + VertexOutput VertexFunction ( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord3 = screenPos; + + o.ase_texcoord4.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + #ifdef ASE_FOG + o.fogFactor = ComputeFogFactor( positionCS.z ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag ( VertexOutput IN ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + float localMyCustomExpression1_g9 = ( 0.0 ); + float4 screenPos = IN.ase_texcoord3; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float mulTime31 = _TimeParameters.x * _TimeScaler; + float2 texCoord30 = IN.ase_texcoord4.xy * (_Vector0).xy + ( (_Vector0).zw * mulTime31 ); + float3 unpack26 = UnpackNormalScale( tex2D( _Normal, texCoord30 ), _NormalScale ); + unpack26.z = lerp( 1, unpack26.z, saturate(_NormalScale) ); + float2 screenUV27_g4 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g4 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g4 = GetScreenNoiseRGBASlice27_g4( screenUV27_g4 , offsetFrame27_g4 ); + float3 temp_output_57_0 = (localGetScreenNoiseRGBASlice27_g4).xyz; + float3 temp_output_60_0 = ( temp_output_57_0 - float3( 0.5,0.5,0.5 ) ); + float3 temp_output_64_0 = ( unpack26 + ( temp_output_60_0 * _NoiseDefusion * 2.0 ) ); + float4 ase_screenPosNorm = screenPos / screenPos.w; + ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; + float screenDepth14 = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH( ase_screenPosNorm.xy ),_ZBufferParams); + float distanceDepth14 = saturate( ( screenDepth14 - LinearEyeDepth( ase_screenPosNorm.z,_ZBufferParams ) ) / ( _EdgeDistance ) ); + float temp_output_15_0 = ( 1.0 - distanceDepth14 ); + float2 uv1_g8 = ( ase_grabScreenPosNorm + float4( ( temp_output_64_0 * ( 1.0 - temp_output_15_0 ) ) , 0.0 ) ).xy; + float level1_g8 = 0.0; + float3 localMyCustomExpression1_g8 = MyCustomExpression1_g8( uv1_g8 , level1_g8 ); + float4 appendResult98 = (float4((( ( float4( localMyCustomExpression1_g8 , 0.0 ) * _Color ) + ( ( temp_output_15_0 * temp_output_15_0 * temp_output_15_0 ) * _EdgeColor ) )).rgb , 1.0)); + float3 lerpResult105 = lerp( float3( 0,0,0 ) , temp_output_57_0 , ( 1.0 - _Color ).rgb); + float3 break94 = lerpResult105; + float2 temp_output_74_0 = abs( (temp_output_64_0).xy ); + float4 appendResult100 = (float4((( _Color * float4( temp_output_60_0 , 0.0 ) )).rgb , saturate( ( max( max( break94.x , break94.y ) , break94.z ) + saturate( max( ( temp_output_74_0 * 30.0 ).x , 0.0 ) ) ) ))); + #ifdef SHADER_API_MOBILE + float4 staticSwitch113 = appendResult100; + #else + float4 staticSwitch113 = appendResult98; + #endif + float4 color1_g9 = staticSwitch113; + float3 WorldSpacePosition1_g9 = WorldPosition; + { + color1_g9 = Volumetrics(color1_g9, WorldSpacePosition1_g9); + } + + float3 BakedAlbedo = 0; + float3 BakedEmission = 0; + float3 Color = color1_g9.xyz; + float Alpha = (staticSwitch113).w; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #if defined(_DBUFFER) + ApplyDecalToBaseColor(IN.clipPos, Color); + #endif + + #if defined(_ALPHAPREMULTIPLY_ON) + Color *= Alpha; + #endif + + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_FOG + Color = MixFog( Color, IN.fogFactor ); + #endif + + return half4( Color, Alpha ); + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + #define REQUIRE_DEPTH_TEXTURE 1 + + + #pragma vertex vert + #pragma fragment frag + + #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/Color.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_texcoord2 : TEXCOORD2; + float4 ase_texcoord3 : TEXCOORD3; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Vector0; + float4 _Color; + float4 _EdgeColor; + float _TimeScaler; + float _NormalScale; + float _NoiseDefusion; + float _EdgeDistance; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _Normal; + uniform float4 _CameraDepthTexture_TexelSize; + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g4( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + float3 MyCustomExpression1_g8( float2 uv, float level ) + { + return SAMPLE_TEXTURE2D_X_LOD(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, UnityStereoTransformScreenSpaceTex(uv),level).rgb; + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord2 = screenPos; + + o.ase_texcoord3.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord3.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.clipPos = TransformWorldToHClip( positionWS ); + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = o.clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float4 screenPos = IN.ase_texcoord2; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float mulTime31 = _TimeParameters.x * _TimeScaler; + float2 texCoord30 = IN.ase_texcoord3.xy * (_Vector0).xy + ( (_Vector0).zw * mulTime31 ); + float3 unpack26 = UnpackNormalScale( tex2D( _Normal, texCoord30 ), _NormalScale ); + unpack26.z = lerp( 1, unpack26.z, saturate(_NormalScale) ); + float2 screenUV27_g4 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g4 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g4 = GetScreenNoiseRGBASlice27_g4( screenUV27_g4 , offsetFrame27_g4 ); + float3 temp_output_57_0 = (localGetScreenNoiseRGBASlice27_g4).xyz; + float3 temp_output_60_0 = ( temp_output_57_0 - float3( 0.5,0.5,0.5 ) ); + float3 temp_output_64_0 = ( unpack26 + ( temp_output_60_0 * _NoiseDefusion * 2.0 ) ); + float4 ase_screenPosNorm = screenPos / screenPos.w; + ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; + float screenDepth14 = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH( ase_screenPosNorm.xy ),_ZBufferParams); + float distanceDepth14 = saturate( ( screenDepth14 - LinearEyeDepth( ase_screenPosNorm.z,_ZBufferParams ) ) / ( _EdgeDistance ) ); + float temp_output_15_0 = ( 1.0 - distanceDepth14 ); + float2 uv1_g8 = ( ase_grabScreenPosNorm + float4( ( temp_output_64_0 * ( 1.0 - temp_output_15_0 ) ) , 0.0 ) ).xy; + float level1_g8 = 0.0; + float3 localMyCustomExpression1_g8 = MyCustomExpression1_g8( uv1_g8 , level1_g8 ); + float4 appendResult98 = (float4((( ( float4( localMyCustomExpression1_g8 , 0.0 ) * _Color ) + ( ( temp_output_15_0 * temp_output_15_0 * temp_output_15_0 ) * _EdgeColor ) )).rgb , 1.0)); + float3 lerpResult105 = lerp( float3( 0,0,0 ) , temp_output_57_0 , ( 1.0 - _Color ).rgb); + float3 break94 = lerpResult105; + float2 temp_output_74_0 = abs( (temp_output_64_0).xy ); + float4 appendResult100 = (float4((( _Color * float4( temp_output_60_0 , 0.0 ) )).rgb , saturate( ( max( max( break94.x , break94.y ) , break94.z ) + saturate( max( ( temp_output_74_0 * 30.0 ).x , 0.0 ) ) ) ))); + #ifdef SHADER_API_MOBILE + float4 staticSwitch113 = appendResult100; + #else + float4 staticSwitch113 = appendResult98; + #endif + + float Alpha = (staticSwitch113).w; + float AlphaClipThreshold = 0.5; + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + return 0; + } + ENDHLSL + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZWrite Off + ZTest LEqual + Offset 0 , 0 + ColorMask RGBA + + + HLSLPROGRAM +#pragma multi_compile_instancing#define _RECEIVE_SHADOWS_OFF 1#define ASE_SRP_VERSION 999999#define REQUIRE_DEPTH_TEXTURE 1 +#if FALSE + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma shader_feature _ _SAMPLE_GI + #pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ DEBUG_DISPLAY + #define SHADERPASS SHADERPASS_UNLIT + + + #pragma vertex vert + #pragma fragment frag + + #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/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl" + + + #define ASE_NEEDS_FRAG_WORLD_POSITION + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef ASE_FOG + float fogFactor : TEXCOORD2; + #endif + float4 ase_texcoord3 : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Vector0; + float4 _Color; + float4 _EdgeColor; + float _TimeScaler; + float _NormalScale; + float _NoiseDefusion; + float _EdgeDistance; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _Normal; + uniform float4 _CameraDepthTexture_TexelSize; + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g4( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + float3 MyCustomExpression1_g8( float2 uv, float level ) + { + return SAMPLE_TEXTURE2D_X_LOD(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, UnityStereoTransformScreenSpaceTex(uv),level).rgb; + } + + + VertexOutput VertexFunction ( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord3 = screenPos; + + o.ase_texcoord4.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + #ifdef ASE_FOG + o.fogFactor = ComputeFogFactor( positionCS.z ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag ( VertexOutput IN ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + float localMyCustomExpression1_g9 = ( 0.0 ); + float4 screenPos = IN.ase_texcoord3; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float mulTime31 = _TimeParameters.x * _TimeScaler; + float2 texCoord30 = IN.ase_texcoord4.xy * (_Vector0).xy + ( (_Vector0).zw * mulTime31 ); + float3 unpack26 = UnpackNormalScale( tex2D( _Normal, texCoord30 ), _NormalScale ); + unpack26.z = lerp( 1, unpack26.z, saturate(_NormalScale) ); + float2 screenUV27_g4 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g4 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g4 = GetScreenNoiseRGBASlice27_g4( screenUV27_g4 , offsetFrame27_g4 ); + float3 temp_output_57_0 = (localGetScreenNoiseRGBASlice27_g4).xyz; + float3 temp_output_60_0 = ( temp_output_57_0 - float3( 0.5,0.5,0.5 ) ); + float3 temp_output_64_0 = ( unpack26 + ( temp_output_60_0 * _NoiseDefusion * 2.0 ) ); + float4 ase_screenPosNorm = screenPos / screenPos.w; + ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; + float screenDepth14 = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH( ase_screenPosNorm.xy ),_ZBufferParams); + float distanceDepth14 = saturate( ( screenDepth14 - LinearEyeDepth( ase_screenPosNorm.z,_ZBufferParams ) ) / ( _EdgeDistance ) ); + float temp_output_15_0 = ( 1.0 - distanceDepth14 ); + float2 uv1_g8 = ( ase_grabScreenPosNorm + float4( ( temp_output_64_0 * ( 1.0 - temp_output_15_0 ) ) , 0.0 ) ).xy; + float level1_g8 = 0.0; + float3 localMyCustomExpression1_g8 = MyCustomExpression1_g8( uv1_g8 , level1_g8 ); + float4 appendResult98 = (float4((( ( float4( localMyCustomExpression1_g8 , 0.0 ) * _Color ) + ( ( temp_output_15_0 * temp_output_15_0 * temp_output_15_0 ) * _EdgeColor ) )).rgb , 1.0)); + float3 lerpResult105 = lerp( float3( 0,0,0 ) , temp_output_57_0 , ( 1.0 - _Color ).rgb); + float3 break94 = lerpResult105; + float2 temp_output_74_0 = abs( (temp_output_64_0).xy ); + float4 appendResult100 = (float4((( _Color * float4( temp_output_60_0 , 0.0 ) )).rgb , saturate( ( max( max( break94.x , break94.y ) , break94.z ) + saturate( max( ( temp_output_74_0 * 30.0 ).x , 0.0 ) ) ) ))); + #ifdef SHADER_API_MOBILE + float4 staticSwitch113 = appendResult100; + #else + float4 staticSwitch113 = appendResult98; + #endif + float4 color1_g9 = staticSwitch113; + float3 WorldSpacePosition1_g9 = WorldPosition; + { + color1_g9 = Volumetrics(color1_g9, WorldSpacePosition1_g9); + } + + float3 BakedAlbedo = 0; + float3 BakedEmission = 0; + float3 Color = color1_g9.xyz; + float Alpha = (staticSwitch113).w; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #if defined(_DBUFFER) + ApplyDecalToBaseColor(IN.clipPos, Color); + #endif + + #if defined(_ALPHAPREMULTIPLY_ON) + Color *= Alpha; + #endif + + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_FOG + Color = MixFog( Color, IN.fogFactor ); + #endif + + return half4( Color, Alpha ); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + #define REQUIRE_DEPTH_TEXTURE 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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/SLZBlueNoise.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 ase_texcoord : TEXCOORD0; + float4 ase_texcoord1 : TEXCOORD1; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Vector0; + float4 _Color; + float4 _EdgeColor; + float _TimeScaler; + float _NormalScale; + float _NoiseDefusion; + float _EdgeDistance; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + sampler2D _Normal; + uniform float4 _CameraDepthTexture_TexelSize; + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g4( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + float3 MyCustomExpression1_g8( float2 uv, float level ) + { + return SAMPLE_TEXTURE2D_X_LOD(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, UnityStereoTransformScreenSpaceTex(uv),level).rgb; + } + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord = screenPos; + + o.ase_texcoord1.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord1.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + float4 screenPos = IN.ase_texcoord; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float mulTime31 = _TimeParameters.x * _TimeScaler; + float2 texCoord30 = IN.ase_texcoord1.xy * (_Vector0).xy + ( (_Vector0).zw * mulTime31 ); + float3 unpack26 = UnpackNormalScale( tex2D( _Normal, texCoord30 ), _NormalScale ); + unpack26.z = lerp( 1, unpack26.z, saturate(_NormalScale) ); + float2 screenUV27_g4 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g4 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g4 = GetScreenNoiseRGBASlice27_g4( screenUV27_g4 , offsetFrame27_g4 ); + float3 temp_output_57_0 = (localGetScreenNoiseRGBASlice27_g4).xyz; + float3 temp_output_60_0 = ( temp_output_57_0 - float3( 0.5,0.5,0.5 ) ); + float3 temp_output_64_0 = ( unpack26 + ( temp_output_60_0 * _NoiseDefusion * 2.0 ) ); + float4 ase_screenPosNorm = screenPos / screenPos.w; + ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; + float screenDepth14 = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH( ase_screenPosNorm.xy ),_ZBufferParams); + float distanceDepth14 = saturate( ( screenDepth14 - LinearEyeDepth( ase_screenPosNorm.z,_ZBufferParams ) ) / ( _EdgeDistance ) ); + float temp_output_15_0 = ( 1.0 - distanceDepth14 ); + float2 uv1_g8 = ( ase_grabScreenPosNorm + float4( ( temp_output_64_0 * ( 1.0 - temp_output_15_0 ) ) , 0.0 ) ).xy; + float level1_g8 = 0.0; + float3 localMyCustomExpression1_g8 = MyCustomExpression1_g8( uv1_g8 , level1_g8 ); + float4 appendResult98 = (float4((( ( float4( localMyCustomExpression1_g8 , 0.0 ) * _Color ) + ( ( temp_output_15_0 * temp_output_15_0 * temp_output_15_0 ) * _EdgeColor ) )).rgb , 1.0)); + float3 lerpResult105 = lerp( float3( 0,0,0 ) , temp_output_57_0 , ( 1.0 - _Color ).rgb); + float3 break94 = lerpResult105; + float2 temp_output_74_0 = abs( (temp_output_64_0).xy ); + float4 appendResult100 = (float4((( _Color * float4( temp_output_60_0 , 0.0 ) )).rgb , saturate( ( max( max( break94.x , break94.y ) , break94.z ) + saturate( max( ( temp_output_74_0 * 30.0 ).x , 0.0 ) ) ) ))); + #ifdef SHADER_API_MOBILE + float4 staticSwitch113 = appendResult100; + #else + float4 staticSwitch113 = appendResult98; + #endif + + surfaceDescription.Alpha = (staticSwitch113).w; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + #define REQUIRE_DEPTH_TEXTURE 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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/SLZBlueNoise.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 ase_texcoord : TEXCOORD0; + float4 ase_texcoord1 : TEXCOORD1; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Vector0; + float4 _Color; + float4 _EdgeColor; + float _TimeScaler; + float _NormalScale; + float _NoiseDefusion; + float _EdgeDistance; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + sampler2D _Normal; + uniform float4 _CameraDepthTexture_TexelSize; + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g4( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + float3 MyCustomExpression1_g8( float2 uv, float level ) + { + return SAMPLE_TEXTURE2D_X_LOD(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, UnityStereoTransformScreenSpaceTex(uv),level).rgb; + } + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord = screenPos; + + o.ase_texcoord1.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord1.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + float4 screenPos = IN.ase_texcoord; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float mulTime31 = _TimeParameters.x * _TimeScaler; + float2 texCoord30 = IN.ase_texcoord1.xy * (_Vector0).xy + ( (_Vector0).zw * mulTime31 ); + float3 unpack26 = UnpackNormalScale( tex2D( _Normal, texCoord30 ), _NormalScale ); + unpack26.z = lerp( 1, unpack26.z, saturate(_NormalScale) ); + float2 screenUV27_g4 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g4 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g4 = GetScreenNoiseRGBASlice27_g4( screenUV27_g4 , offsetFrame27_g4 ); + float3 temp_output_57_0 = (localGetScreenNoiseRGBASlice27_g4).xyz; + float3 temp_output_60_0 = ( temp_output_57_0 - float3( 0.5,0.5,0.5 ) ); + float3 temp_output_64_0 = ( unpack26 + ( temp_output_60_0 * _NoiseDefusion * 2.0 ) ); + float4 ase_screenPosNorm = screenPos / screenPos.w; + ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; + float screenDepth14 = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH( ase_screenPosNorm.xy ),_ZBufferParams); + float distanceDepth14 = saturate( ( screenDepth14 - LinearEyeDepth( ase_screenPosNorm.z,_ZBufferParams ) ) / ( _EdgeDistance ) ); + float temp_output_15_0 = ( 1.0 - distanceDepth14 ); + float2 uv1_g8 = ( ase_grabScreenPosNorm + float4( ( temp_output_64_0 * ( 1.0 - temp_output_15_0 ) ) , 0.0 ) ).xy; + float level1_g8 = 0.0; + float3 localMyCustomExpression1_g8 = MyCustomExpression1_g8( uv1_g8 , level1_g8 ); + float4 appendResult98 = (float4((( ( float4( localMyCustomExpression1_g8 , 0.0 ) * _Color ) + ( ( temp_output_15_0 * temp_output_15_0 * temp_output_15_0 ) * _EdgeColor ) )).rgb , 1.0)); + float3 lerpResult105 = lerp( float3( 0,0,0 ) , temp_output_57_0 , ( 1.0 - _Color ).rgb); + float3 break94 = lerpResult105; + float2 temp_output_74_0 = abs( (temp_output_64_0).xy ); + float4 appendResult100 = (float4((( _Color * float4( temp_output_60_0 , 0.0 ) )).rgb , saturate( ( max( max( break94.x , break94.y ) , break94.z ) + saturate( max( ( temp_output_74_0 * 30.0 ).x , 0.0 ) ) ) ))); + #ifdef SHADER_API_MOBILE + float4 staticSwitch113 = appendResult100; + #else + float4 staticSwitch113 = appendResult98; + #endif + + surfaceDescription.Alpha = (staticSwitch113).w; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormalsOnly" } + + ZTest LEqual + ZWrite On + + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + #define REQUIRE_DEPTH_TEXTURE 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma multi_compile_fog + #pragma instancing_options renderinglayer + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define VARYINGS_NEED_NORMAL_WS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/SLZBlueNoise.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float3 normalWS : TEXCOORD0; + float4 ase_texcoord1 : TEXCOORD1; + float4 ase_texcoord2 : TEXCOORD2; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Vector0; + float4 _Color; + float4 _EdgeColor; + float _TimeScaler; + float _NormalScale; + float _NoiseDefusion; + float _EdgeDistance; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _Normal; + uniform float4 _CameraDepthTexture_TexelSize; + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g4( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + float3 MyCustomExpression1_g8( float2 uv, float level ) + { + return SAMPLE_TEXTURE2D_X_LOD(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, UnityStereoTransformScreenSpaceTex(uv),level).rgb; + } + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord1 = screenPos; + + o.ase_texcoord2.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord2.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal(v.ase_normal); + + o.clipPos = TransformWorldToHClip(positionWS); + o.normalWS.xyz = normalWS; + + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + float4 screenPos = IN.ase_texcoord1; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float mulTime31 = _TimeParameters.x * _TimeScaler; + float2 texCoord30 = IN.ase_texcoord2.xy * (_Vector0).xy + ( (_Vector0).zw * mulTime31 ); + float3 unpack26 = UnpackNormalScale( tex2D( _Normal, texCoord30 ), _NormalScale ); + unpack26.z = lerp( 1, unpack26.z, saturate(_NormalScale) ); + float2 screenUV27_g4 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g4 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g4 = GetScreenNoiseRGBASlice27_g4( screenUV27_g4 , offsetFrame27_g4 ); + float3 temp_output_57_0 = (localGetScreenNoiseRGBASlice27_g4).xyz; + float3 temp_output_60_0 = ( temp_output_57_0 - float3( 0.5,0.5,0.5 ) ); + float3 temp_output_64_0 = ( unpack26 + ( temp_output_60_0 * _NoiseDefusion * 2.0 ) ); + float4 ase_screenPosNorm = screenPos / screenPos.w; + ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; + float screenDepth14 = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH( ase_screenPosNorm.xy ),_ZBufferParams); + float distanceDepth14 = saturate( ( screenDepth14 - LinearEyeDepth( ase_screenPosNorm.z,_ZBufferParams ) ) / ( _EdgeDistance ) ); + float temp_output_15_0 = ( 1.0 - distanceDepth14 ); + float2 uv1_g8 = ( ase_grabScreenPosNorm + float4( ( temp_output_64_0 * ( 1.0 - temp_output_15_0 ) ) , 0.0 ) ).xy; + float level1_g8 = 0.0; + float3 localMyCustomExpression1_g8 = MyCustomExpression1_g8( uv1_g8 , level1_g8 ); + float4 appendResult98 = (float4((( ( float4( localMyCustomExpression1_g8 , 0.0 ) * _Color ) + ( ( temp_output_15_0 * temp_output_15_0 * temp_output_15_0 ) * _EdgeColor ) )).rgb , 1.0)); + float3 lerpResult105 = lerp( float3( 0,0,0 ) , temp_output_57_0 , ( 1.0 - _Color ).rgb); + float3 break94 = lerpResult105; + float2 temp_output_74_0 = abs( (temp_output_64_0).xy ); + float4 appendResult100 = (float4((( _Color * float4( temp_output_60_0 , 0.0 ) )).rgb , saturate( ( max( max( break94.x , break94.y ) , break94.z ) + saturate( max( ( temp_output_74_0 * 30.0 ).x , 0.0 ) ) ) ))); + #ifdef SHADER_API_MOBILE + float4 staticSwitch113 = appendResult100; + #else + float4 staticSwitch113 = appendResult98; + #endif + + surfaceDescription.Alpha = (staticSwitch113).w; + surfaceDescription.AlphaClipThreshold = 0.5; + + #if _ALPHATEST_ON + clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + float3 normalWS = IN.normalWS; + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + + } + + ENDHLSL + } + + + Pass + { + + Name "DepthNormalsOnly" + Tags { "LightMode"="DepthNormalsOnly" } + + ZTest LEqual + ZWrite On + + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + #define REQUIRE_DEPTH_TEXTURE 1 + + + #pragma exclude_renderers glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD1 + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/SLZBlueNoise.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float3 normalWS : TEXCOORD0; + float4 ase_texcoord1 : TEXCOORD1; + float4 ase_texcoord2 : TEXCOORD2; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Vector0; + float4 _Color; + float4 _EdgeColor; + float _TimeScaler; + float _NormalScale; + float _NoiseDefusion; + float _EdgeDistance; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _Normal; + uniform float4 _CameraDepthTexture_TexelSize; + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g4( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + float3 MyCustomExpression1_g8( float2 uv, float level ) + { + return SAMPLE_TEXTURE2D_X_LOD(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, UnityStereoTransformScreenSpaceTex(uv),level).rgb; + } + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord1 = screenPos; + + o.ase_texcoord2.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord2.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal(v.ase_normal); + + o.clipPos = TransformWorldToHClip(positionWS); + o.normalWS.xyz = normalWS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + float4 screenPos = IN.ase_texcoord1; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float mulTime31 = _TimeParameters.x * _TimeScaler; + float2 texCoord30 = IN.ase_texcoord2.xy * (_Vector0).xy + ( (_Vector0).zw * mulTime31 ); + float3 unpack26 = UnpackNormalScale( tex2D( _Normal, texCoord30 ), _NormalScale ); + unpack26.z = lerp( 1, unpack26.z, saturate(_NormalScale) ); + float2 screenUV27_g4 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g4 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g4 = GetScreenNoiseRGBASlice27_g4( screenUV27_g4 , offsetFrame27_g4 ); + float3 temp_output_57_0 = (localGetScreenNoiseRGBASlice27_g4).xyz; + float3 temp_output_60_0 = ( temp_output_57_0 - float3( 0.5,0.5,0.5 ) ); + float3 temp_output_64_0 = ( unpack26 + ( temp_output_60_0 * _NoiseDefusion * 2.0 ) ); + float4 ase_screenPosNorm = screenPos / screenPos.w; + ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; + float screenDepth14 = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH( ase_screenPosNorm.xy ),_ZBufferParams); + float distanceDepth14 = saturate( ( screenDepth14 - LinearEyeDepth( ase_screenPosNorm.z,_ZBufferParams ) ) / ( _EdgeDistance ) ); + float temp_output_15_0 = ( 1.0 - distanceDepth14 ); + float2 uv1_g8 = ( ase_grabScreenPosNorm + float4( ( temp_output_64_0 * ( 1.0 - temp_output_15_0 ) ) , 0.0 ) ).xy; + float level1_g8 = 0.0; + float3 localMyCustomExpression1_g8 = MyCustomExpression1_g8( uv1_g8 , level1_g8 ); + float4 appendResult98 = (float4((( ( float4( localMyCustomExpression1_g8 , 0.0 ) * _Color ) + ( ( temp_output_15_0 * temp_output_15_0 * temp_output_15_0 ) * _EdgeColor ) )).rgb , 1.0)); + float3 lerpResult105 = lerp( float3( 0,0,0 ) , temp_output_57_0 , ( 1.0 - _Color ).rgb); + float3 break94 = lerpResult105; + float2 temp_output_74_0 = abs( (temp_output_64_0).xy ); + float4 appendResult100 = (float4((( _Color * float4( temp_output_60_0 , 0.0 ) )).rgb , saturate( ( max( max( break94.x , break94.y ) , break94.z ) + saturate( max( ( temp_output_74_0 * 30.0 ).x , 0.0 ) ) ) ))); + #ifdef SHADER_API_MOBILE + float4 staticSwitch113 = appendResult100; + #else + float4 staticSwitch113 = appendResult98; + #endif + + surfaceDescription.Alpha = (staticSwitch113).w; + surfaceDescription.AlphaClipThreshold = 0.5; + + #if _ALPHATEST_ON + clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + float3 normalWS = IN.normalWS; + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphUnlitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +348;596;2495;1397;768.8135;508.2479;1;True;True +Node;AmplifyShaderEditor.RangedFloatNode;33;-2623.422,285.6297;Inherit;False;Property;_TimeScaler;Time Scaler;5;0;Create;True;0;0;0;True;0;False;0;0.5;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.Vector4Node;38;-2533.989,45.28711;Inherit;False;Property;_Vector0;Vector 0;6;0;Create;True;0;0;0;True;0;False;1,1,0,0;0.01,1,0,-1;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SwizzleNode;40;-2344.733,140.3067;Inherit;False;FLOAT2;2;3;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleTimeNode;31;-2434.626,281.5258;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FunctionNode;56;-2843.489,682.7742;Inherit;True;Global Blue Noise Sample;-1;;4;bac712bbbce65c14c9d4cbc808f3d0e0;0;2;8;FLOAT2;0,0;False;10;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.SwizzleNode;57;-2494.688,665.4838;Inherit;False;FLOAT3;0;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SwizzleNode;39;-2345.777,56.68601;Inherit;False;FLOAT2;0;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;42;-2190.038,199.8864;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.RangedFloatNode;58;-2539.488,787.0839;Inherit;False;Property;_NoiseDefusion;Noise Defusion;8;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;60;-2293.285,650.127;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0.5,0.5,0.5;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.RangedFloatNode;29;-2264.535,549.5233;Inherit;False;Property;_NormalScale;Normal Scale;4;0;Create;True;0;0;0;False;0;False;1;0.005;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;59;-2131.998,781.0203;Inherit;False;Constant;_Float1;Float 1;8;0;Create;True;0;0;0;False;0;False;2;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;30;-2023.442,133.185;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;61;-2135.284,668.1271;Inherit;False;3;3;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SamplerNode;26;-1714.431,220.1914;Inherit;True;Property;_Normal;Normal;3;0;Create;True;0;0;0;False;0;False;-1;None;2ba2085b33bf11d43a9426e5eb7a2902;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;22;-1570.032,659.9443;Inherit;False;Property;_EdgeDistance;Edge Distance;2;0;Create;True;0;0;0;False;0;False;0.1;0.13;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;64;-1351.414,245.1566;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.CommentaryNode;111;-2250.552,-1145.886;Inherit;False;2708.299;805.0335;Android variation;18;74;75;89;76;105;94;77;79;93;80;95;109;103;107;100;90;99;110;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.DepthFade;14;-1355.945,653.6127;Inherit;False;True;True;False;2;1;FLOAT3;0,0,0;False;0;FLOAT;0.2;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;19;-846.6503,-182.6969;Inherit;False;Property;_Color;Color;0;1;[HDR];Create;True;0;0;0;False;0;False;1,1,1,0;1,0.4103774,0.4524934,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.OneMinusNode;15;-1054.045,600.9127;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SwizzleNode;110;-2200.552,-839.0759;Inherit;False;FLOAT2;0;1;2;3;1;0;FLOAT3;0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.OneMinusNode;36;-1135.297,370.4312;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;75;-1828.17,-979.5426;Inherit;False;Constant;_Float0;Float 0;11;0;Create;True;0;0;0;False;0;False;30;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.AbsOpNode;74;-1992.394,-835.0392;Inherit;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.OneMinusNode;89;-520.7108,-784.2026;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.LerpOp;105;-313.1315,-1095.886;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;76;-1552.77,-1040.743;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;37;-1109.006,224.9539;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.GrabScreenPosition;25;-1270.398,20.4839;Inherit;False;0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleAddOpNode;28;-1016.67,108.2705;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.BreakToComponentsNode;94;-139.4934,-1013.937;Inherit;False;FLOAT3;1;0;FLOAT3;0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 +Node;AmplifyShaderEditor.BreakToComponentsNode;77;-1339.853,-1070.498;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;23;-883.0327,567.9443;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;21;-968.7116,725.8766;Inherit;False;Property;_EdgeColor;Edge Color;1;1;[HDR];Create;True;0;0;0;False;0;False;1,1,1,0;2.337647,0.4,0.121293,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMaxOpNode;79;-1210.853,-1085.498;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMaxOpNode;93;16.76184,-947.3367;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FunctionNode;73;-848.6816,94.34859;Inherit;False;GrabScreenColorManualLevel;-1;;8;b7c9b6b3581e5364c833193cd43e9ba8;0;2;5;FLOAT2;0,0;False;2;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SaturateNode;80;-1037.675,-1090.238;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;18;-412.6502,-128.0968;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;20;-683.4601,370.531;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMaxOpNode;95;166.6133,-907.6324;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;90;-495.1148,-561.4131;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;17;-315.7252,146.4916;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;109;285.2019,-839.184;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SaturateNode;103;292.747,-681.5574;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SwizzleNode;99;-207.8187,-530.8778;Inherit;False;FLOAT3;0;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SwizzleNode;97;-176.5121,130.2798;Inherit;False;FLOAT3;0;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.DynamicAppendNode;100;225.0844,-475.853;Inherit;False;FLOAT4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.DynamicAppendNode;98;-180.3545,32.94035;Inherit;False;FLOAT4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;1;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.StaticSwitch;113;136.8126,-22.49399;Inherit;False;Property;_Keyword0;SHADER_API_MOBILE;10;0;Create;False;0;0;0;False;0;False;0;0;0;False;SHADER_API_MOBILE;Toggle;2;Key0;Key1;Fetch;False;True;Fragment;9;1;FLOAT4;0,0,0,0;False;0;FLOAT4;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;3;FLOAT4;0,0,0,0;False;4;FLOAT4;0,0,0,0;False;5;FLOAT4;0,0,0,0;False;6;FLOAT4;0,0,0,0;False;7;FLOAT4;0,0,0,0;False;8;FLOAT4;0,0,0,0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.OneMinusNode;107;-1762.517,-824.3533;Inherit;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SamplerNode;43;-1595.401,893.2531;Inherit;True;Property;_TextureSample0;Texture Sample 0;7;0;Create;True;0;0;0;False;0;False;-1;None;c77738f9b82bdc047a63d7b33b2b9874;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.TimeNode;65;-2438.836,368.3835;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.WorldPosInputsNode;88;330.4374,110.2684;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SwizzleNode;101;857.0782,44.50648;Inherit;False;FLOAT;3;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FunctionNode;87;537.5373,-39.83163;Inherit;False;VolumetricsUnlit;-1;;9;800698b1441791d449f3e84fa3283d1e;0;2;2;FLOAT4;0,0,0,0;False;3;FLOAT3;0,0,0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;53;388.8,16.69999;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthNormals;0;8;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormalsOnly;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;47;388.8,16.69999;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;54;388.8,16.69999;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthNormalsOnly;0;9;DepthNormalsOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormalsOnly;False;True;15;d3d9;d3d11_9x;d3d11;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;49;388.8,16.69999;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;50;388.8,16.69999;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;5;False;-1;10;False;-1;1;1;False;-1;10;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;2;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;45;539.9322,73.05437;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;52;388.8,16.69999;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ScenePickingPass;0;7;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;51;388.8,16.69999;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;SceneSelectionPass;0;6;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;46;1160.733,-37.34563;Half;False;True;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;SLZ/ForceField;2992e84f91cbeb14eab234972e07ea9d;True;Forward;0;1;Forward;8;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;5;False;-1;10;False;-1;1;1;False;-1;10;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;2;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=UniversalForwardOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;22;Surface;1;637971395290964121; Blend;0;0;Two Sided;0;637971395840501447;Cast Shadows;0;637971395248012710; Use Shadow Threshold;0;0;Receive Shadows;0;637971395242512077;GPU Instancing;1;0;LOD CrossFade;0;0;Built-in Fog;0;0;DOTS Instancing;0;0;Meta Pass;0;0;Extra Pre Pass;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Vertex Position,InvertActionOnDeselection;1;0;0;10;False;True;False;True;False;True;True;True;True;True;False;;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;48;388.8,16.69999;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +WireConnection;40;0;38;0 +WireConnection;31;0;33;0 +WireConnection;57;0;56;0 +WireConnection;39;0;38;0 +WireConnection;42;0;40;0 +WireConnection;42;1;31;0 +WireConnection;60;0;57;0 +WireConnection;30;0;39;0 +WireConnection;30;1;42;0 +WireConnection;61;0;60;0 +WireConnection;61;1;58;0 +WireConnection;61;2;59;0 +WireConnection;26;1;30;0 +WireConnection;26;5;29;0 +WireConnection;64;0;26;0 +WireConnection;64;1;61;0 +WireConnection;14;0;22;0 +WireConnection;15;0;14;0 +WireConnection;110;0;64;0 +WireConnection;36;0;15;0 +WireConnection;74;0;110;0 +WireConnection;89;0;19;0 +WireConnection;105;1;57;0 +WireConnection;105;2;89;0 +WireConnection;76;0;74;0 +WireConnection;76;1;75;0 +WireConnection;37;0;64;0 +WireConnection;37;1;36;0 +WireConnection;28;0;25;0 +WireConnection;28;1;37;0 +WireConnection;94;0;105;0 +WireConnection;77;0;76;0 +WireConnection;23;0;15;0 +WireConnection;23;1;15;0 +WireConnection;23;2;15;0 +WireConnection;79;0;77;0 +WireConnection;93;0;94;0 +WireConnection;93;1;94;1 +WireConnection;73;5;28;0 +WireConnection;80;0;79;0 +WireConnection;18;0;73;0 +WireConnection;18;1;19;0 +WireConnection;20;0;23;0 +WireConnection;20;1;21;0 +WireConnection;95;0;93;0 +WireConnection;95;1;94;2 +WireConnection;90;0;19;0 +WireConnection;90;1;60;0 +WireConnection;17;0;18;0 +WireConnection;17;1;20;0 +WireConnection;109;0;95;0 +WireConnection;109;1;80;0 +WireConnection;103;0;109;0 +WireConnection;99;0;90;0 +WireConnection;97;0;17;0 +WireConnection;100;0;99;0 +WireConnection;100;3;103;0 +WireConnection;98;0;97;0 +WireConnection;113;1;98;0 +WireConnection;113;0;100;0 +WireConnection;107;0;74;0 +WireConnection;101;0;113;0 +WireConnection;87;2;113;0 +WireConnection;87;3;88;0 +WireConnection;46;2;87;0 +WireConnection;46;3;101;0 +ASEEND*/ +//CHKSM=DE2FCCF1C3516DBF2FAAE2DB9B798309F4E86BE5 \ No newline at end of file diff --git a/Assets/SLZShaders/ForceField.shader.meta b/Assets/SLZShaders/ForceField.shader.meta new file mode 100644 index 0000000..bca176c --- /dev/null +++ b/Assets/SLZShaders/ForceField.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 6bf3d81d08a4ff343b22619a187bb249 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include.meta b/Assets/SLZShaders/Include.meta new file mode 100644 index 0000000..c3d162f --- /dev/null +++ b/Assets/SLZShaders/Include.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ae65e6fd73412a843ad0abebcd7f7754 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle.meta b/Assets/SLZShaders/Include/Particle.meta new file mode 100644 index 0000000..f74d85f --- /dev/null +++ b/Assets/SLZShaders/Include/Particle.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 05cb88a931e735a4b9ad942dbbbf3ed7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector.meta new file mode 100644 index 0000000..f400777 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: baf0cae36873ec6479fc0c926f732068 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Base.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/Base.meta new file mode 100644 index 0000000..61ce6be --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Base.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98a02e34c0c4b8748ade0ad9cd5a2611 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Base/Base_Particle.hlsl b/Assets/SLZShaders/Include/Particle/ShaderInjector/Base/Base_Particle.hlsl new file mode 100644 index 0000000..c63a2f7 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Base/Base_Particle.hlsl @@ -0,0 +1,152 @@ + +#pragma target 5.0 +//#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + +#if defined(SHADER_API_MOBILE) + //#!INJECT_POINT MOBILE_DEFINES +#else + //#!INJECT_POINT STANDALONE_DEFINES +#endif + +//#!INJECT_POINT UNIVERSAL_DEFINES + +#pragma multi_compile_fog +#pragma skip_variants FOG_LINEAR +#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED +#pragma multi_compile_instancing +#pragma instancing_options procedural:ParticleInstancingSetup + + + +#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.core/ShaderLibrary/Packing.hlsl" +#include "Include/Particle/billboard.hlsl" +//#!INJECT_POINT INCLUDES + +struct appdata +{ + float4 vertex : POSITION; + float4 uv0_vertexStream0_xy : TEXCOORD0; + half4 color : COLOR; + //#!INJECT_POINT VERTEX_IN + //#!INJECT_DEFAULT + float vertexStream1 : TEXCOORD1; + //#!INJECT_END + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct v2f +{ + //#!INJECT_POINT VERTEX_CENTROID + //#!INJECT_DEFAULT + float4 vertex : SV_POSITION; + //#!INJECT_END + float2 uv0 : TEXCOORD0; + float4 wPos_xyz_fog_x : TEXCOORD1; + half4 color : COLOR; + //#!INJECT_POINT INTERPOLATORS + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +struct fragOut +{ + half4 color : SV_Target; + //#!INJECT_POINT OUTPUT_SEMANTICS +}; + +//#include "Include/PlatformSamplers.hlsl" + +TEXTURE2D(_BaseMap); +SamplerState sampler_BaseMap; + +//#!INJECT_POINT UNIFORMS + +CBUFFER_START(UnityPerMaterial) +float4 _BaseMap_ST; +half4 _BaseColor; +//#!INJECT_POINT MATERIAL_CBUFFER +CBUFFER_END + +//#!INJECT_POINT FUNCTIONS + +v2f vert(appdata v) +{ + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + //#!INJECT_POINT VERT_BEGIN + + //#!INJECT_POINT VERT_TRANSFORM + //#!INJECT_DEFAULT + float3 particleCenter = float3(v.uv0_vertexStream0_xy.zw, v.vertexStream1.x); + v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, particleCenter); + //#!INJECT_END + o.wPos_xyz_fog_x.xyz = TransformObjectToWorld(v.vertex.xyz); + o.vertex = TransformWorldToHClip(o.wPos_xyz_fog_x.xyz); + o.uv0 = TRANSFORM_TEX(v.uv0_vertexStream0_xy.xy, _BaseMap); + half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z); + o.wPos_xyz_fog_x.w = unity_FogParams.x * clipZ_0Far; + o.color = v.color; + + //#!INJECT_POINT VERT_END + + return o; +} + +fragOut frag(v2f i) +{ + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + + fragOut f; + + //#!INJECT_POINT FRAG_BEGIN + + //#!INJECT_POINT FRAG_COLOR + //#!INJECT_DEFAULT + f.color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv0); + f.color *= _BaseColor * i.color; + //#!INJECT_END + + //#!INJECT_POINT FRAG_FOG + //#!INJECT_DEFAULT + half3 viewDir = normalize(half3(i.wPos_xyz_fog_x.xyz - _WorldSpaceCameraPos)); + #if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + #if defined(SLZ_PARTICLE_ADDITIVE) + f.color.rgb *= 1.0 - ComputeFogIntensity(i.wPos_xyz_fog_x.w); + #elif defined(SLZ_PARTICLE_MULTIPLICATIVE) + f.color.rgb = lerp(f.color.rgb, half3(1,1,1), ComputeFogIntensity(i.wPos_xyz_fog_x.w)); + #elif defined(SLZ_PARTICLE_ALPHABLEND) + f.color.rgb = MixFog(f.color.rgb, viewDir, i.wPos_xyz_fog_x.w); + #endif + #endif + //#!INJECT_END + + + //#!INJECT_POINT FRAG_VOLUMETRICS + //#!INJECT_DEFAULT + #if defined(SLZ_PARTICLE_ADDITIVE) + #if defined(_VOLUMETRICS_ENABLED) + f.color *= GetVolumetricColor(i.wPos_xyz_fog_x.xyz).a; + #endif + #elif defined(SLZ_PARTICLE_ALPHABLEND) + f.color = Volumetrics(f.color, i.wPos_xyz_fog_x.xyz); + #endif + //#!INJECT_END + + //#!INJECT_POINT FRAG_END + + return f; +} \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Base/Base_Particle.hlsl.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/Base/Base_Particle.hlsl.meta new file mode 100644 index 0000000..f88bcf3 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Base/Base_Particle.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2df13d630bf74324fbefa9003b6544b3 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections.meta new file mode 100644 index 0000000..8864d5b --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4e0ec44885694984b843804e07b56a1c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_SoftBlend.hlsl b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_SoftBlend.hlsl new file mode 100644 index 0000000..e008a94 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_SoftBlend.hlsl @@ -0,0 +1,42 @@ +//#!INJECT_BEGIN INCLUDES 0 +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZSoftBlend.hlsl" +//#!INJECT_END + +//#!INJECT_BEGIN MATERIAL_CBUFFER 0 + float _SoftFactor; +//#!INJECT_END + +//#!INJECT_BEGIN VERTEX_CENTROID 0 +#if defined(SHADER_API_MOBILE) + centroid float4 vertex : SV_POSITION; +#else + float4 vertex : SV_POSITION; +#endif +//#!INJECT_END + +//#!INJECT_BEGIN OUTPUT_SEMANTICS 0 +#if defined(SHADER_API_MOBILE) + float depth : SV_DepthLessEqual; +#endif +//#!INJECT_END + + +//#!INJECT_BEGIN FRAG_END 99 + #if defined(SHADER_API_MOBILE) + half noise = GetScreenNoiseR(screenUVs); + f.depth = SLZSoftBlendZTest(i.vertex.z, noise, _SoftFactor); + #else + float rawDepth = SampleSceneDepth(screenUVs); + float viewZ = dot(GetWorldToViewMatrix()._m20_m21_m22_m23, float4(i.wPos_xyz_fog_x.xyz, 1)); + float fade = SLZSoftBlendDepth(rawDepth, viewZ, _SoftFactor); + #if defined(SLZ_PARTICLE_ADDITIVE) + f.color *= fade; + #elif defined(SLZ_PARTICLE_MULTIPLICATIVE) + f.color = lerp(fade, float4(1,1,1,1), f.color)); + #else + f.color.a *= fade; + #endif + #endif +//#!INJECT_END \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_SoftBlend.hlsl.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_SoftBlend.hlsl.meta new file mode 100644 index 0000000..b342ae3 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_SoftBlend.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f42ab72a6a8465649be290d03a8f1981 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_screenspaceUVs.hlsl b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_screenspaceUVs.hlsl new file mode 100644 index 0000000..d4151ff --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_screenspaceUVs.hlsl @@ -0,0 +1,4 @@ + +//#!INJECT_BEGIN FRAG_BEGIN -1 + float2 screenUVs = GetNormalizedScreenSpaceUV(i.vertex); +//#!INJECT_END \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_screenspaceUVs.hlsl.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_screenspaceUVs.hlsl.meta new file mode 100644 index 0000000..2b76c85 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Particle_screenspaceUVs.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 03859193eb793184ca8cc47738d7109d +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Torch.hlsl b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Torch.hlsl new file mode 100644 index 0000000..dbb7363 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Torch.hlsl @@ -0,0 +1,39 @@ +//#!INJECT_BEGIN UNIFORMS 0 + TEXTURE2D(_ScreenSpacePattern); + SAMPLER(sampler_ScreenSpacePattern); +//#!INJECT_END + +//#!INJECT_BEGIN MATERIAL_CBUFFER 0 + half _Speed; + half _SecondarySpeed; + float _ScreenSpaceSize; + float _ParticleOffset; +//#!INJECT_END + +//#!INJECT_BEGIN FUNCTIONS 0 + float2 RotateTorchUVs(float2 uv, float2 center, float angle) + { + uv = uv - center; + float sin1, cos1; + sincos(angle, sin1, cos1); + float2x2 rotMat = float2x2(cos1, -sin1, sin1, cos1); + uv = mul(rotMat, uv); + return uv + center; + } +//#!INJECT_END + +//#!INJECT_BEGIN VERT_BEGIN 0 + v.vertex.z += _ParticleOffset; +//#!INJECT_END + +//#!INJECT_BEGIN FRAG_COLOR 0 + float angle1 = frac(_Time[0] * 3.1830988618 * _Speed) * TWO_PI; + float angle2 = frac(_Time[0] * 3.1830988618 * _Speed * _SecondarySpeed) * TWO_PI; + angle1 = -angle1; + float2 uv1 = RotateTorchUVs(i.uv0.xy, float2(0.5, 0.5), angle1); + half layer1 = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv1).r; + float2 uv2 = RotateTorchUVs(i.uv0.xy, float2(0.5, 0.5), angle2); + half layer2 = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv2).r; + half4 SSPattern = SAMPLE_TEXTURE2D(_ScreenSpacePattern, sampler_ScreenSpacePattern, _ScreenParams.xy * screenUVs / _ScreenSpaceSize); + f.color = (layer1 * layer2 * i.color.a) * SSPattern * _BaseColor * i.color; +//#!INJECT_END \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Torch.hlsl.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Torch.hlsl.meta new file mode 100644 index 0000000..d01ad64 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/Injections/Injection_Torch.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2a6fc1acbba5a6045a0692bfb9a7a8f2 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.asset b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.asset new file mode 100644 index 0000000..9d1d25b --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.asset @@ -0,0 +1,17 @@ +%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: bd7d1f8f9838c1541abbb5c264b254f6, type: 3} + m_Name: ParticleBasic + m_EditorClassIdentifier: + outputInclude: {fileID: 10900000, guid: c156fe6f1c50d864f8ceb85b935236f7, type: 3} + baseInclude: {fileID: 10900000, guid: 2df13d630bf74324fbefa9003b6544b3, type: 3} + injectableIncludes: [] diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.asset.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.asset.meta new file mode 100644 index 0000000..3d58a56 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 36686d6671a56b04f9401216e0ff9ae5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.hlsl b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.hlsl new file mode 100644 index 0000000..c076d42 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.hlsl @@ -0,0 +1,128 @@ +/*-----------------------------------------------------------------------------------------------------* + *-----------------------------------------------------------------------------------------------------* + * WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE * + * BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * + *-----------------------------------------------------------------------------------------------------* + *-----------------------------------------------------------------------------------------------------*/ + + +#pragma target 5.0 +//#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + +#if defined(SHADER_API_MOBILE) +#else +#endif + + +#pragma multi_compile_fog +#pragma skip_variants FOG_LINEAR +#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED +#pragma multi_compile_instancing +#pragma instancing_options procedural:ParticleInstancingSetup + + + +#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.core/ShaderLibrary/Packing.hlsl" +#include "Include/Particle/billboard.hlsl" + +struct appdata +{ + float4 vertex : POSITION; + float4 uv0_vertexStream0_xy : TEXCOORD0; + half4 color : COLOR; + float vertexStream1 : TEXCOORD1; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct v2f +{ + float4 vertex : SV_POSITION; + float2 uv0 : TEXCOORD0; + float4 wPos_xyz_fog_x : TEXCOORD1; + half4 color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +struct fragOut +{ + half4 color : SV_Target; +}; + +//#include "Include/PlatformSamplers.hlsl" + +TEXTURE2D(_BaseMap); +SamplerState sampler_BaseMap; + + +CBUFFER_START(UnityPerMaterial) +float4 _BaseMap_ST; +half4 _BaseColor; +CBUFFER_END + + +v2f vert(appdata v) +{ + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + float3 particleCenter = float3(v.uv0_vertexStream0_xy.zw, v.vertexStream1.x); + v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, particleCenter); + o.wPos_xyz_fog_x.xyz = TransformObjectToWorld(v.vertex.xyz); + o.vertex = TransformWorldToHClip(o.wPos_xyz_fog_x.xyz); + o.uv0 = TRANSFORM_TEX(v.uv0_vertexStream0_xy.xy, _BaseMap); + half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z); + o.wPos_xyz_fog_x.w = unity_FogParams.x * clipZ_0Far; + o.color = v.color; + + + return o; +} + +fragOut frag(v2f i) +{ + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + + fragOut f; + + + f.color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv0); + f.color *= _BaseColor * i.color; + + half3 viewDir = normalize(half3(i.wPos_xyz_fog_x.xyz - _WorldSpaceCameraPos)); + #if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + #if defined(SLZ_PARTICLE_ADDITIVE) + f.color.rgb *= 1.0 - ComputeFogIntensity(i.wPos_xyz_fog_x.w); + #elif defined(SLZ_PARTICLE_MULTIPLICATIVE) + f.color.rgb = lerp(f.color.rgb, half3(1,1,1), ComputeFogIntensity(i.wPos_xyz_fog_x.w)); + #elif defined(SLZ_PARTICLE_ALPHABLEND) + f.color.rgb = MixFog(f.color.rgb, viewDir, i.wPos_xyz_fog_x.w); + #endif + #endif + + + #if defined(SLZ_PARTICLE_ADDITIVE) + #if defined(_VOLUMETRICS_ENABLED) + f.color *= GetVolumetricColor(i.wPos_xyz_fog_x.xyz).a; + #endif + #elif defined(SLZ_PARTICLE_ALPHABLEND) + f.color = Volumetrics(f.color, i.wPos_xyz_fog_x.xyz); + #endif + + + return f; +} \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.hlsl.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.hlsl.meta new file mode 100644 index 0000000..8545923 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleBasic.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c156fe6f1c50d864f8ceb85b935236f7 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.asset b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.asset new file mode 100644 index 0000000..563a762 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.asset @@ -0,0 +1,19 @@ +%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: bd7d1f8f9838c1541abbb5c264b254f6, type: 3} + m_Name: ParticleSoft + m_EditorClassIdentifier: + outputInclude: {fileID: 10900000, guid: 005850956c06e3c4d9126500376c9a40, type: 3} + baseInclude: {fileID: 10900000, guid: 2df13d630bf74324fbefa9003b6544b3, type: 3} + injectableIncludes: + - {fileID: 10900000, guid: 03859193eb793184ca8cc47738d7109d, type: 3} + - {fileID: 10900000, guid: f42ab72a6a8465649be290d03a8f1981, type: 3} diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.asset.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.asset.meta new file mode 100644 index 0000000..80fd69c --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 390d76c4ec3c32e4e8ecc2b49aa78a1c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.hlsl b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.hlsl new file mode 100644 index 0000000..ef2dc26 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.hlsl @@ -0,0 +1,175 @@ +/*-----------------------------------------------------------------------------------------------------* + *-----------------------------------------------------------------------------------------------------* + * WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE * + * BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * + *-----------------------------------------------------------------------------------------------------* + *-----------------------------------------------------------------------------------------------------*/ + + +#pragma target 5.0 +//#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + +#if defined(SHADER_API_MOBILE) +#else +#endif + + +#pragma multi_compile_fog +#pragma skip_variants FOG_LINEAR +#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED +#pragma multi_compile_instancing +#pragma instancing_options procedural:ParticleInstancingSetup + + + +#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.core/ShaderLibrary/Packing.hlsl" +#include "Include/Particle/billboard.hlsl" +// Begin Injection INCLUDES from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +#if defined(SHADER_API_MOBILE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" +#else + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" +#endif +// End Injection INCLUDES from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + +struct appdata +{ + float4 vertex : POSITION; + float4 uv0_vertexStream0_xy : TEXCOORD0; + half4 color : COLOR; + float vertexStream1 : TEXCOORD1; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct v2f +{ +// Begin Injection VERTEX_CENTROID from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +#if defined(SHADER_API_MOBILE) + centroid float4 vertex : SV_POSITION; +#else + float4 vertex : SV_POSITION; +#endif +// End Injection VERTEX_CENTROID from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + float2 uv0 : TEXCOORD0; + float4 wPos_xyz_fog_x : TEXCOORD1; + half4 color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +struct fragOut +{ + half4 color : SV_Target; +// Begin Injection OUTPUT_SEMANTICS from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +#if defined(SHADER_API_MOBILE) + float depth : SV_DepthLessEqual; +#endif +// End Injection OUTPUT_SEMANTICS from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +}; + +//#include "Include/PlatformSamplers.hlsl" + +TEXTURE2D(_BaseMap); +SamplerState sampler_BaseMap; + + +CBUFFER_START(UnityPerMaterial) +float4 _BaseMap_ST; +half4 _BaseColor; +// Begin Injection MATERIAL_CBUFFER from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + float _SoftFactor; +// End Injection MATERIAL_CBUFFER from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +CBUFFER_END + + +v2f vert(appdata v) +{ + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + float3 particleCenter = float3(v.uv0_vertexStream0_xy.zw, v.vertexStream1.x); + v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, particleCenter); + o.wPos_xyz_fog_x.xyz = TransformObjectToWorld(v.vertex.xyz); + o.vertex = TransformWorldToHClip(o.wPos_xyz_fog_x.xyz); + o.uv0 = TRANSFORM_TEX(v.uv0_vertexStream0_xy.xy, _BaseMap); + half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z); + o.wPos_xyz_fog_x.w = unity_FogParams.x * clipZ_0Far; + o.color = v.color; + + + return o; +} + +fragOut frag(v2f i) +{ + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + + fragOut f; + +// Begin Injection FRAG_BEGIN from Injection_Particle_screenspaceUVs.hlsl ---------------------------------------------------------- + float2 screenUVs = GetNormalizedScreenSpaceUV(i.vertex); +// End Injection FRAG_BEGIN from Injection_Particle_screenspaceUVs.hlsl ---------------------------------------------------------- + + f.color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv0); + f.color *= _BaseColor * i.color; + + half3 viewDir = normalize(half3(i.wPos_xyz_fog_x.xyz - _WorldSpaceCameraPos)); + #if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + #if defined(SLZ_PARTICLE_ADDITIVE) + f.color.rgb *= 1.0 - ComputeFogIntensity(i.wPos_xyz_fog_x.w); + #elif defined(SLZ_PARTICLE_MULTIPLICATIVE) + f.color.rgb = lerp(f.color.rgb, half3(1,1,1), ComputeFogIntensity(i.wPos_xyz_fog_x.w)); + #elif defined(SLZ_PARTICLE_ALPHABLEND) + f.color.rgb = MixFog(f.color.rgb, viewDir, i.wPos_xyz_fog_x.w); + #endif + #endif + + + #if defined(SLZ_PARTICLE_ADDITIVE) + #if defined(_VOLUMETRICS_ENABLED) + f.color *= GetVolumetricColor(i.wPos_xyz_fog_x.xyz).a; + #endif + #elif defined(SLZ_PARTICLE_ALPHABLEND) + f.color = Volumetrics(f.color, i.wPos_xyz_fog_x.xyz); + #endif + +// Begin Injection FRAG_END from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + #if defined(SHADER_API_MOBILE) + half noise = GetScreenNoiseR(screenUVs); + float depthOffset = _SoftFactor * noise * noise ; + float vertDepth = i.vertex.z; + float cameraZ = 1.0 / (_ZBufferParams.z * vertDepth + _ZBufferParams.w); + cameraZ += depthOffset; + f.depth = (rcp(cameraZ) - _ZBufferParams.w) / _ZBufferParams.z; + #else + float rawDepth = SampleSceneDepth(screenUVs); + float sceneZ = (unity_OrthoParams.w == 0) ? LinearEyeDepth(rawDepth, _ZBufferParams) : LinearDepthToEyeDepth(rawDepth); + float thisZ = LinearEyeDepth(i.wPos_xyz_fog_x.xyz, GetWorldToViewMatrix()); + float fade = saturate((1 / _SoftFactor) * (sceneZ - thisZ)); + fade *= fade; + #if defined(SLZ_PARTICLE_ADDITIVE) + f.color *= fade; + #elif defined(SLZ_PARTICLE_MULTIPLICATIVE) + f.color = lerp(fade, float4(1,1,1,1), f.color)); + #else + f.color.a *= fade; + #endif + #endif +// End Injection FRAG_END from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + + return f; +} \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.hlsl.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.hlsl.meta new file mode 100644 index 0000000..6282eb8 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleSoft.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 005850956c06e3c4d9126500376c9a40 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.asset b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.asset new file mode 100644 index 0000000..e35eec3 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.asset @@ -0,0 +1,20 @@ +%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: bd7d1f8f9838c1541abbb5c264b254f6, type: 3} + m_Name: ParticleTorch + m_EditorClassIdentifier: + outputInclude: {fileID: 10900000, guid: 2313d59684d119840a78fee73c48959a, type: 3} + baseInclude: {fileID: 10900000, guid: 2df13d630bf74324fbefa9003b6544b3, type: 3} + injectableIncludes: + - {fileID: 10900000, guid: 03859193eb793184ca8cc47738d7109d, type: 3} + - {fileID: 10900000, guid: f42ab72a6a8465649be290d03a8f1981, type: 3} + - {fileID: 10900000, guid: 2a6fc1acbba5a6045a0692bfb9a7a8f2, type: 3} diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.asset.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.asset.meta new file mode 100644 index 0000000..f23d197 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 88f1b8e9d502e19419d88bca2cab94da +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.hlsl b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.hlsl new file mode 100644 index 0000000..a4953fe --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.hlsl @@ -0,0 +1,200 @@ +/*-----------------------------------------------------------------------------------------------------* + *-----------------------------------------------------------------------------------------------------* + * WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE * + * BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * + *-----------------------------------------------------------------------------------------------------* + *-----------------------------------------------------------------------------------------------------*/ + + +#pragma target 5.0 +//#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + +#if defined(SHADER_API_MOBILE) +#else +#endif + + +#pragma multi_compile_fog +#pragma skip_variants FOG_LINEAR +#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED +#pragma multi_compile_instancing +#pragma instancing_options procedural:ParticleInstancingSetup + + + +#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.core/ShaderLibrary/Packing.hlsl" +#include "Include/Particle/billboard.hlsl" +// Begin Injection INCLUDES from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZSoftBlend.hlsl" +// End Injection INCLUDES from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + +struct appdata +{ + float4 vertex : POSITION; + float4 uv0_vertexStream0_xy : TEXCOORD0; + half4 color : COLOR; + float vertexStream1 : TEXCOORD1; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct v2f +{ +// Begin Injection VERTEX_CENTROID from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +#if defined(SHADER_API_MOBILE) + centroid float4 vertex : SV_POSITION; +#else + float4 vertex : SV_POSITION; +#endif +// End Injection VERTEX_CENTROID from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + float2 uv0 : TEXCOORD0; + float4 wPos_xyz_fog_x : TEXCOORD1; + half4 color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +struct fragOut +{ + half4 color : SV_Target; +// Begin Injection OUTPUT_SEMANTICS from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +#if defined(SHADER_API_MOBILE) + float depth : SV_DepthLessEqual; +#endif +// End Injection OUTPUT_SEMANTICS from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +}; + +//#include "Include/PlatformSamplers.hlsl" + +TEXTURE2D(_BaseMap); +SamplerState sampler_BaseMap; + +// Begin Injection UNIFORMS from Injection_Torch.hlsl ---------------------------------------------------------- + TEXTURE2D(_ScreenSpacePattern); + SAMPLER(sampler_ScreenSpacePattern); +// End Injection UNIFORMS from Injection_Torch.hlsl ---------------------------------------------------------- + +CBUFFER_START(UnityPerMaterial) +float4 _BaseMap_ST; +half4 _BaseColor; +// Begin Injection MATERIAL_CBUFFER from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + float _SoftFactor; +// End Injection MATERIAL_CBUFFER from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- +// Begin Injection MATERIAL_CBUFFER from Injection_Torch.hlsl ---------------------------------------------------------- + half _Speed; + half _SecondarySpeed; + float _ScreenSpaceSize; + float _ParticleOffset; +// End Injection MATERIAL_CBUFFER from Injection_Torch.hlsl ---------------------------------------------------------- +CBUFFER_END + +// Begin Injection FUNCTIONS from Injection_Torch.hlsl ---------------------------------------------------------- + float2 RotateTorchUVs(float2 uv, float2 center, float angle) + { + uv = uv - center; + float sin1, cos1; + sincos(angle, sin1, cos1); + float2x2 rotMat = float2x2(cos1, -sin1, sin1, cos1); + uv = mul(rotMat, uv); + return uv + center; + } +// End Injection FUNCTIONS from Injection_Torch.hlsl ---------------------------------------------------------- + +v2f vert(appdata v) +{ + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +// Begin Injection VERT_BEGIN from Injection_Torch.hlsl ---------------------------------------------------------- + v.vertex.z += _ParticleOffset; +// End Injection VERT_BEGIN from Injection_Torch.hlsl ---------------------------------------------------------- + + float3 particleCenter = float3(v.uv0_vertexStream0_xy.zw, v.vertexStream1.x); + v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, particleCenter); + o.wPos_xyz_fog_x.xyz = TransformObjectToWorld(v.vertex.xyz); + o.vertex = TransformWorldToHClip(o.wPos_xyz_fog_x.xyz); + o.uv0 = TRANSFORM_TEX(v.uv0_vertexStream0_xy.xy, _BaseMap); + half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z); + o.wPos_xyz_fog_x.w = unity_FogParams.x * clipZ_0Far; + o.color = v.color; + + + return o; +} + +fragOut frag(v2f i) +{ + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + + fragOut f; + +// Begin Injection FRAG_BEGIN from Injection_Particle_screenspaceUVs.hlsl ---------------------------------------------------------- + float2 screenUVs = GetNormalizedScreenSpaceUV(i.vertex); +// End Injection FRAG_BEGIN from Injection_Particle_screenspaceUVs.hlsl ---------------------------------------------------------- + +// Begin Injection FRAG_COLOR from Injection_Torch.hlsl ---------------------------------------------------------- + float angle1 = frac(_Time[0] * 3.1830988618 * _Speed) * TWO_PI; + float angle2 = frac(_Time[0] * 3.1830988618 * _Speed * _SecondarySpeed) * TWO_PI; + angle1 = -angle1; + float2 uv1 = RotateTorchUVs(i.uv0.xy, float2(0.5, 0.5), angle1); + half layer1 = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv1).r; + float2 uv2 = RotateTorchUVs(i.uv0.xy, float2(0.5, 0.5), angle2); + half layer2 = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv2).r; + half4 SSPattern = SAMPLE_TEXTURE2D(_ScreenSpacePattern, sampler_ScreenSpacePattern, _ScreenParams.xy * screenUVs / _ScreenSpaceSize); + f.color = (layer1 * layer2 * i.color.a) * SSPattern * _BaseColor * i.color; +// End Injection FRAG_COLOR from Injection_Torch.hlsl ---------------------------------------------------------- + + half3 viewDir = normalize(half3(i.wPos_xyz_fog_x.xyz - _WorldSpaceCameraPos)); + #if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + #if defined(SLZ_PARTICLE_ADDITIVE) + f.color.rgb *= 1.0 - ComputeFogIntensity(i.wPos_xyz_fog_x.w); + #elif defined(SLZ_PARTICLE_MULTIPLICATIVE) + f.color.rgb = lerp(f.color.rgb, half3(1,1,1), ComputeFogIntensity(i.wPos_xyz_fog_x.w)); + #elif defined(SLZ_PARTICLE_ALPHABLEND) + f.color.rgb = MixFog(f.color.rgb, viewDir, i.wPos_xyz_fog_x.w); + #endif + #endif + + + #if defined(SLZ_PARTICLE_ADDITIVE) + #if defined(_VOLUMETRICS_ENABLED) + f.color *= GetVolumetricColor(i.wPos_xyz_fog_x.xyz).a; + #endif + #elif defined(SLZ_PARTICLE_ALPHABLEND) + f.color = Volumetrics(f.color, i.wPos_xyz_fog_x.xyz); + #endif + +// Begin Injection FRAG_END from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + #if defined(SHADER_API_MOBILE) + half noise = GetScreenNoiseR(screenUVs); + f.depth = SLZSoftBlendZTest(i.vertex.z, noise, _SoftFactor); + #else + float rawDepth = SampleSceneDepth(screenUVs); + float viewZ = dot(GetWorldToViewMatrix()._m20_m21_m22_m23, float4(i.wPos_xyz_fog_x.xyz, 1)); + float fade = SLZSoftBlendDepth(rawDepth, viewZ, _SoftFactor); + #if defined(SLZ_PARTICLE_ADDITIVE) + f.color *= fade; + #elif defined(SLZ_PARTICLE_MULTIPLICATIVE) + f.color = lerp(fade, float4(1,1,1,1), f.color)); + #else + f.color.a *= fade; + #endif + #endif +// End Injection FRAG_END from Injection_Particle_SoftBlend.hlsl ---------------------------------------------------------- + + return f; +} \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.hlsl.meta b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.hlsl.meta new file mode 100644 index 0000000..1b468f1 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/ShaderInjector/ParticleTorch.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2313d59684d119840a78fee73c48959a +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/amplify_billboard_injector.hlsl b/Assets/SLZShaders/Include/Particle/amplify_billboard_injector.hlsl new file mode 100644 index 0000000..434d623 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/amplify_billboard_injector.hlsl @@ -0,0 +1 @@ +v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, v.ase_texcoord1.xyz); \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Particle/amplify_billboard_injector.hlsl.meta b/Assets/SLZShaders/Include/Particle/amplify_billboard_injector.hlsl.meta new file mode 100644 index 0000000..9a69362 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/amplify_billboard_injector.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0e6e0041457dfeb47936aa37f7c4bfdf +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/amplify_billboard_injector_flare.hlsl b/Assets/SLZShaders/Include/Particle/amplify_billboard_injector_flare.hlsl new file mode 100644 index 0000000..64b33df --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/amplify_billboard_injector_flare.hlsl @@ -0,0 +1 @@ +v.vertex.xyz = MeshFlareBillboard(v.vertex.xyz); \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Particle/amplify_billboard_injector_flare.hlsl.meta b/Assets/SLZShaders/Include/Particle/amplify_billboard_injector_flare.hlsl.meta new file mode 100644 index 0000000..2b0afbc --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/amplify_billboard_injector_flare.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 75872890b046c074fac20ab6d18e52b1 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Particle/billboard.hlsl b/Assets/SLZShaders/Include/Particle/billboard.hlsl new file mode 100644 index 0000000..c9963f0 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/billboard.hlsl @@ -0,0 +1,94 @@ +float3 centerEyePos() +{ + #if defined(UNITY_STEREO_MULTIVIEW_ENABLED) || defined(UNITY_STEREO_INSTANCING_ENABLED) + return 0.5 * (unity_StereoWorldSpaceCameraPos[0] + unity_StereoWorldSpaceCameraPos[1]); + #else + return _WorldSpaceCameraPos; + #endif +} + +/** Rotates a particle to face the camera in a more vr-correct way than unity's default particle system + * + */ + +float3 particle_face_camera(float3 vertex, inout float3 normal, inout float3 center) +{ + vertex.xyz -= center; + + float3 head = centerEyePos(); + float3 centerToEye = normalize(center-head); + float c2eXZLen = length(centerToEye.xz); + float sin1 = -centerToEye.y; + float cos1 = c2eXZLen; + float2x2 rotPitch = float2x2(cos1, sin1, -sin1, cos1); + + vertex.zy = mul(rotPitch, vertex.zy); + normal.zy = mul(rotPitch, normal.zy); + //tangent.zy = mul(rotPitch, tangent.zy); + + float sin2 = centerToEye.x/c2eXZLen; + float cos2 = centerToEye.z/c2eXZLen; + float2x2 rotYaw = float2x2(cos2, sin2, -sin2, cos2); + + vertex.xz = mul(rotYaw,vertex.xz); + normal.xz = mul(rotYaw,normal.xz); + //tangent.xz = mul(rotYaw,tangent.xz); + + vertex.xyz += center; + return vertex; +} + + + + +float3 ParticleFaceCamera(float3 vertex, float3 center) +{ + vertex.xyz -= center; + + float3 head = centerEyePos(); + float3 centerToEye = normalize(center - head); + float c2eXZLen = length(centerToEye.xz); + float sin1 = -centerToEye.y; + float cos1 = c2eXZLen; + float2x2 rotPitch = float2x2(cos1, sin1, -sin1, cos1); + + vertex.zy = mul(rotPitch, vertex.zy); + + + float sin2 = centerToEye.x / c2eXZLen; + float cos2 = centerToEye.z / c2eXZLen; + float2x2 rotYaw = float2x2(cos2, sin2, -sin2, cos2); + + vertex.xz = mul(rotYaw, vertex.xz); + + + vertex.xyz += center; + return vertex; +} + +float3 MeshFaceCamera(float3 vertex) +{ + float3 center = float3(0,0,0); + //vertex = TransformObjectToWorld(vertex); + + float3 head = TransformWorldToObject(centerEyePos()); + float3 centerToEye = normalize(center - head); + float c2eXZLen = length(centerToEye.xz); + float sin1 = -centerToEye.y; + float cos1 = c2eXZLen; + float2x2 rotPitch = float2x2(cos1, sin1, -sin1, cos1); + + vertex.zy = mul(rotPitch, vertex.zy); + + + float sin2 = centerToEye.x / c2eXZLen; + float cos2 = centerToEye.z / c2eXZLen; + float2x2 rotYaw = float2x2(cos2, sin2, -sin2, cos2); + + vertex.xz = mul(rotYaw, vertex.xz); + + + //vertex.xyz += center; + return vertex; +} + diff --git a/Assets/SLZShaders/Include/Particle/billboard.hlsl.meta b/Assets/SLZShaders/Include/Particle/billboard.hlsl.meta new file mode 100644 index 0000000..9ad0e98 --- /dev/null +++ b/Assets/SLZShaders/Include/Particle/billboard.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 40dd6881c3760054cacc50fdba7554dc +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/PlatformSamplers.hlsl b/Assets/SLZShaders/Include/PlatformSamplers.hlsl new file mode 100644 index 0000000..19fea63 --- /dev/null +++ b/Assets/SLZShaders/Include/PlatformSamplers.hlsl @@ -0,0 +1,16 @@ +#if defined(SHADER_API_MOBILE) // Quest 2 (XR2) works better with combined texture-samplers apparently + +#ifdef TEXTURE2D +#undef TEXTURE2D +#endif +#ifdef SAMPLER +#undef SAMPLER +#endif +#ifdef SAMPLE_TEXTURE2D +#undef SAMPLE_TEXTURE2D +#endif + +#define TEXTURE2D(textureName) sampler2D textureName +#define SAMPLER(samplerName) +#define SAMPLE_TEXTURE2D(textureName, samplerName, coord) tex2D(textureName, coord) +#endif \ No newline at end of file diff --git a/Assets/SLZShaders/Include/PlatformSamplers.hlsl.meta b/Assets/SLZShaders/Include/PlatformSamplers.hlsl.meta new file mode 100644 index 0000000..9afd0a7 --- /dev/null +++ b/Assets/SLZShaders/Include/PlatformSamplers.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6aab105c75192124887c893201ce93e0 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Include/Triplanar.hlsl b/Assets/SLZShaders/Include/Triplanar.hlsl new file mode 100644 index 0000000..5a1f302 --- /dev/null +++ b/Assets/SLZShaders/Include/Triplanar.hlsl @@ -0,0 +1,95 @@ +#if !defined(SLZ_TRIPLANAR_INCLUDED) +#define SLZ_TRIPLANAR_INCLUDED +//#define TEXTURE2D_PARAM(textureName, samplerName) Texture2D textureName, sampler samplerName + +/** + * Struct containg the ddx and ddy of the uvs combined into one half4 for each axis + */ +struct tpDerivatives +{ + half4 ddX; + half4 ddY; + half4 ddZ; +}; + +/** + * Gets the derivatives of the worldspace coordinates reduced to 3 2 dimensional planes defined by each axis + * + * @param wPos Worldspace position + * @param[out] dd struct containing the x and y derivatives of each plane + */ +void GetDirectionalDerivatives(float3 wPos, out tpDerivatives dd) +{ + dd.ddX.xy = ddx(wPos.zy); + dd.ddY.xy = ddx(wPos.xz); + dd.ddZ.xy = ddx(wPos.xy); + dd.ddX.zw = ddy(wPos.zy); + dd.ddY.zw = ddy(wPos.xz); + dd.ddZ.zw = ddy(wPos.xy); +} + +/** + * Determines the worldspace axis that the given mesh normal is most closely aligned to, and returns the coordinates of the + * pixel in the plane aligned with that axis and the derivatives associated with that plane. Also generates a tangent to world + * matrix using the axes orthogonal to the dominant axis as the tangent and bitangent. + * + * @param[out] triplanarUV Coordinates of the fragment in the plane aligned with the dominant axis + * @param[out] ddxMax X derivatives of the coordinates of the fragment in the plane aligned with the dominant axis + * @param[out] ddyMax Y derivatives of the coordinates of the fragment in the plane aligned with the dominant axis + * @param[out] tanToWrld Tangent to world matrix composed of the other two axes as tangent and bitangent, and the mesh normal as the normal + * @param wPos World-space position of the fragment + * @param wNorm World-space mesh normal + * @param dd derivatives of the fragment's coordinates in each axis aligned plane + */ +void GetTPUVExpensive(out float2 triplanarUV, out half2 ddxMax, out half2 ddyMax, out half3x3 tanToWrld, float3 wPos, half3 wNorm, + tpDerivatives dd) +{ + half3 dir; + dir.x = abs(wNorm.x) > abs(wNorm.y) && abs(wNorm.x) > abs(wNorm.z) ? 1 : 0; + dir.y = abs(wNorm.y) >= abs(wNorm.x) && abs(wNorm.y) > abs(wNorm.z) ? 1 : 0; + dir.z = abs(wNorm.z) >= abs(wNorm.y) && abs(wNorm.z) >= abs(wNorm.x) ? 1 : 0; + half3 dirSign = sign(wNorm); + dirSign.z = -dirSign.z; // u should be flipped on Z + ddxMax = dir.x * dd.ddX.xy + dir.y * dd.ddY.xy + dir.z * dd.ddZ.xy; + ddyMax = dir.x * dd.ddX.zw + dir.y * dd.ddY.zw + dir.z * dd.ddZ.zw; + //half3 maxDir = half3(dirX, dirY, dirZ); + float2 uvX = wPos.zy * float2(dirSign.x, 1.0); + triplanarUV = dir.x * uvX; + float2 uvY = wPos.xz * float2(dirSign.y, 1.0); + triplanarUV = mad(dir.y, uvY, triplanarUV); + float2 uvZ = wPos.xy * float2(dirSign.z, 1.0); + triplanarUV = mad(dir.z, uvZ, triplanarUV); + + + tanToWrld = half3x3( + dir.y * dirSign.y + dir.z * dirSign.z, 0, wNorm.x, + 0, dir.x + dir.z, wNorm.y, + dir.x * dirSign.x, dir.y, wNorm.z + ); + +} + +void GetTPUVCheap(out float2 triplanarUV, out half3x3 tanToWrld, float3 wPos, half3 wNorm) +{ + half3 dir; + dir.x = abs(wNorm.x) > abs(wNorm.y) && abs(wNorm.x) > abs(wNorm.z) ? 1 : 0; + dir.y = abs(wNorm.y) >= abs(wNorm.x) && abs(wNorm.y) > abs(wNorm.z) ? 1 : 0; + dir.z = abs(wNorm.z) >= abs(wNorm.y) && abs(wNorm.z) >= abs(wNorm.x) ? 1 : 0; + half3 dirSign = sign(wNorm); + dirSign.z = -dirSign.z; // u should be flipped on Z + //half3 maxDir = half3(dirX, dirY, dirZ); + float2 uvX = wPos.zy * float2(dirSign.x, 1.0); + triplanarUV = dir.x * uvX; + float2 uvY = wPos.xz * float2(dirSign.y, 1.0); + triplanarUV = mad(dir.y, uvY, triplanarUV); + float2 uvZ = wPos.xy * float2(dirSign.z, 1.0); + triplanarUV = mad(dir.z, uvZ, triplanarUV); + + tanToWrld = half3x3( + dir.y * dirSign.y + dir.z * dirSign.z, 0, wNorm.x, + 0, dir.x + dir.z, wNorm.y, + dir.x * dirSign.x, dir.y, wNorm.z + ); +} + +#endif \ No newline at end of file diff --git a/Assets/SLZShaders/Include/Triplanar.hlsl.meta b/Assets/SLZShaders/Include/Triplanar.hlsl.meta new file mode 100644 index 0000000..0f104a7 --- /dev/null +++ b/Assets/SLZShaders/Include/Triplanar.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 225aec2e7a259b642a9fa1a4d10d7aac +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Mod2x.shader b/Assets/SLZShaders/Mod2x.shader new file mode 100644 index 0000000..2b7c376 --- /dev/null +++ b/Assets/SLZShaders/Mod2x.shader @@ -0,0 +1,225 @@ +Shader "SLZ/Mod2x" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) + _MainTex("MainTex", 2D) = "gray" {} + [HDR]_Color("Color", Color) = (1,1,1,0) + _OffsetUnits("OffsetUnits", Int) = -2 + _OffsetFactor("OffsetFactor", Int) = -2 + _Multiplier("Multiplier", Float) = 1 + [Toggle(_ALPHA_ON)] _alpha("alpha", Float) = 0 + [Toggle(_VERTEXCOLORS_ON)] _VertexColors("VertexColors", Float) = 1 + // [HideInInspector] _texcoord( "", 2D ) = "white" {} + + // [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 + { + LOD 0 + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Transparent" "Queue"="Transparent-499" "IgnoreProjector" = "True"} + + Cull Back + AlphaToMask Off + + HLSLINCLUDE + #pragma target 5.0 + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + ENDHLSL + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForward" } + + Blend DstColor SrcColor + ZWrite Off + ZTest LEqual + Offset [_OffsetFactor] , [_OffsetUnits] + ColorMask RGBA + + HLSLPROGRAM + + #define _RECEIVE_SHADOWS_OFF 1 + #pragma multi_compile_instancing + #define ASE_SRP_VERSION 999999 + #define SHADERPASS SHADERPASS_UNLIT + + #pragma vertex vert + #pragma fragment frag + + #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/ShaderLibrary/DBuffer.hlsl" + //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl" + //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl" + + + #define ASE_NEEDS_FRAG_COLOR + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma shader_feature _ALPHA_ON + #pragma shader_feature _VERTEXCOLORS_ON + #pragma multi_compile _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fog + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + float4 ase_color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float fogFactor : TEXCOORD2; + float4 ase_texcoord3 : TEXCOORD3; + float4 ase_color : COLOR; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + int _OffsetUnits; + int _OffsetFactor; + float _Multiplier; + CBUFFER_END + sampler2D _MainTex; + + shared float _StaticLightMultiplier; + + + VertexOutput VertexFunction ( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord4 = screenPos; + o.ase_texcoord3.xy = v.ase_texcoord.xy; + o.ase_color = v.ase_color; + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord3.zw = 0; + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + o.fogFactor = ComputeFogFactor( positionCS.z ); + o.clipPos = positionCS; + return o; + } + + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + + half3 Mod2xFog(half3 fragColor, half fogFactor) + { + #if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + half fogIntensity = ComputeFogIntensity(fogFactor); + fragColor = lerp(0.5, fragColor, fogIntensity); + #endif + return fragColor; + } + + half4 frag ( VertexOutput IN ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float localMyCustomExpression1_g126 = ( 0.0 ); + float2 uv_MainTex = IN.ase_texcoord3.xy * _MainTex_ST.xy + _MainTex_ST.zw; + float4 appendResult52 = (float4(1.0 , 1.0 , 1.0 , IN.ase_color.a)); + #ifdef _VERTEXCOLORS_ON + float4 staticSwitch38 = IN.ase_color; + #else + float4 staticSwitch38 = appendResult52; + #endif + float4 temp_output_16_0 = ( tex2D( _MainTex, uv_MainTex ) * _Color * staticSwitch38 ); + float4 temp_output_26_0 = ( ( ( temp_output_16_0 - .5 ) * _Multiplier ) + 0.5 ); + #ifdef _ALPHA_ON + float4 lerpResult30 = lerp( .5 , temp_output_26_0 , (temp_output_16_0).a); + float4 staticSwitch28 = lerpResult30; + #else + float4 staticSwitch28 = temp_output_26_0; + #endif + float4 color1_g126 = staticSwitch28; + float localMyCustomExpression24_g126 = ( 0.0 ); + float4 screenPos = IN.ase_texcoord4; + float4 ase_screenPosNorm = screenPos / screenPos.w; + ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; + float2 uv24_g126 = (ase_screenPosNorm).xy; + + float3 BakedAlbedo = 0; + float3 BakedEmission = 0; + float3 Color = color1_g126.xyz; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #if defined(_ALPHAPREMULTIPLY_ON) + Color *= Alpha; + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + Color.rgb = Mod2xFog( Color, IN.fogFactor ); + + #if defined(_VOLUMETRICS_ENABLED) + //works fine on the PC but not quest. Using a semi-plausible result otherwise. + #if !defined(SHADER_API_MOBILE) + half3 FroxelColor = GetVolumetricColor(WorldPosition).rgb; + Color.rgb = Color.rgb - 0.5* (2.0*Color.rgb - 1.0) * FroxelColor / SampleSceneColor(uv24_g126).rgb; + #else + half4 FroxelColor = GetVolumetricColor(IN.worldPos); + Color.rgb = Color.rgb + (saturate(FroxelColor.rgb)*(0.5-Color.rgb)); //rgb lerp //x + s(y-x) + Color.rgb = lerp(0.5, Color , saturate(FroxelColor.a*FroxelColor.a) ); + #endif + #endif + + return half4( Color, Alpha ); + } + + ENDHLSL + } + } + Fallback "Hidden/InternalErrorShader" +} \ No newline at end of file diff --git a/Assets/SLZShaders/Mod2x.shader.meta b/Assets/SLZShaders/Mod2x.shader.meta new file mode 100644 index 0000000..0f63294 --- /dev/null +++ b/Assets/SLZShaders/Mod2x.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 4c21875978f9ed04d9edcf6d97e9ed54 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/NullShader.shader b/Assets/SLZShaders/NullShader.shader new file mode 100644 index 0000000..774c6b4 --- /dev/null +++ b/Assets/SLZShaders/NullShader.shader @@ -0,0 +1,3426 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/Nullman" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) + [ASEBegin]_BaseMap("_BaseMap", 2D) = "white" {} + [NoScaleOffset]g_tBRDFMap("BRDF map", 2D) = "white" {} + [NoScaleOffset]_WireColor("WireColor", 2D) = "white" {} + _WireScale("Wire Scale", Float) = 3 + _Refraction("Refraction", Range( 0.5 , 1)) = 0.884 + _Smoothness("Smoothness", Range( 0 , 1)) = 0 + _Metallic("Metallic", Range( 0 , 1)) = 0 + [HDR]_Emission("Emission", Color) = (1,1,1,1) + [NoScaleOffset][SingleLineTexture]_HitRamp("Hit Ramp", 2D) = "black" {} + [HideInInspector]_NumberOfHits("_NumberOfHits", Int) = 0 + _Cubemap("Cubemap", CUBE) = "white" {} + [ASEEnd][Toggle]_CustomCubemap("Custom Cubemap", Float) = 1 + [HideInInspector] _texcoord( "", 2D ) = "white" {} + + [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) = "" {} + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + + + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" } + Cull Back + ZWrite On + ZTest LEqual + Offset 0 , 0 + AlphaToMask Off + + HLSLINCLUDE + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForward" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_FORWARD + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.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.core/ShaderLibrary/TextureStack.hlsl" + + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + #pragma shader_feature_local_fragment _BRDFMAP + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl" + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.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.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + float4 ase_texcoord9 : TEXCOORD9; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + half4x4 EllipsoidPosArray[HitMatrixCount]; + float4 _BaseMap_ST; + float4 _Emission; + int _NumberOfHits; + float _CustomCubemap; + float _Refraction; + float _WireScale; + float _Metallic; + float _Smoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + TEXTURECUBE(_Cubemap); + SAMPLER(sampler_Cubemap); + TEXTURE2D(_WireColor); + SAMPLER(sampler_WireColor); + + + half2 PosespaceImpacts_A( float3 Posespace ) + { + return GetClosestImpactUV( Posespace, EllipsoidPosArray , _NumberOfHits ); + } + + half2 SampleHitTex( half2 ImpactsUV ) + { + return SampleHitTexture(ImpactsUV); + } + + float3 MyCustomExpression( float3 viewDirectionWS, float blur ) + { + return DecodeHDREnvironment(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0 , viewDirectionWS, blur*UNITY_SPECCUBE_LOD_STEPS), unity_SpecCube0_HDR); + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xyz = v.texcoord.xyz; + o.ase_texcoord9.xyz = v.texcoord1.xyz; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.w = 0; + o.ase_texcoord9.w = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + #endif + + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) || defined(ASE_TERRAIN_INSTANCING) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float3 normalizedWorldNormal = normalize( WorldNormal ); + float dotResult13 = dot( normalizedWorldNormal , WorldViewDirection ); + float temp_output_89_0 = saturate( dotResult13 ); + float2 uv_BaseMap = IN.ase_texcoord8.xyz.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float4 tex2DNode8 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ); + float4 temp_output_14_0 = ( temp_output_89_0 * temp_output_89_0 * tex2DNode8 ); + + float3 texCoord31 = IN.ase_texcoord9.xyz; + texCoord31.xy = IN.ase_texcoord9.xyz.xy * float2( 1,1 ) + float2( 0,0 ); + half3 Posespace29 = texCoord31; + half2 localPosespaceImpacts_A29 = PosespaceImpacts_A( Posespace29 ); + half2 ImpactsUV137 = localPosespaceImpacts_A29; + half2 localSampleHitTex137 = SampleHitTex( ImpactsUV137 ); + float temp_output_144_0 = min( (localSampleHitTex137).y , ( 1.0 - floor( (localPosespaceImpacts_A29).x ) ) ); + float3 temp_output_66_0 = refract( -WorldViewDirection , normalizedWorldNormal , _Refraction ); + float3 viewDirectionWS58 = temp_output_66_0; + float temp_output_65_0 = ( 1.0 - temp_output_89_0 ); + float blur58 = temp_output_65_0; + float3 localMyCustomExpression58 = MyCustomExpression( viewDirectionWS58 , blur58 ); + float3 texCoord5 = IN.ase_texcoord9.xyz; + texCoord5.xy = IN.ase_texcoord9.xyz.xy * float2( 1,1 ) + float2( 0,0 ); + float4 tex2DNode7 = SAMPLE_TEXTURE2D( _WireColor, sampler_WireColor, ( texCoord5 * _WireScale ).xy ); + float4 blendOpSrc129 = tex2DNode8; + float4 blendOpDest129 = tex2DNode7; + float4 lerpBlendMode129 = lerp(blendOpDest129,abs( blendOpSrc129 - blendOpDest129 ),saturate( (0.0 + (temp_output_65_0 - 0.48) * (1.0 - 0.0) / (1.0 - 0.48)) )); + float temp_output_145_0 = ( 1.0 - temp_output_144_0 ); + float4 lerpResult160 = lerp( (( _CustomCubemap )?( SAMPLE_TEXTURECUBE_LOD( _Cubemap, sampler_Cubemap, temp_output_66_0, temp_output_65_0 ) ):( float4( localMyCustomExpression58 , 0.0 ) )) , ( ( lerpBlendMode129 + ( (( _CustomCubemap )?( SAMPLE_TEXTURECUBE_LOD( _Cubemap, sampler_Cubemap, temp_output_66_0, temp_output_65_0 ) ):( float4( localMyCustomExpression58 , 0.0 ) )) * temp_output_14_0 ) ) * temp_output_145_0 * _Emission ) , min( temp_output_145_0 , tex2DNode7.a )); + + float3 Albedo = temp_output_14_0.rgb; + float3 Normal = float3(0, 0, 1); + float3 Emission = ( float4( ( localSampleHitTex137 * temp_output_144_0 ), 0.0 , 0.0 ) + lerpResult160 ).rgb; +#if 0 + float3 BakedEmission = 0; +#endif + float3 Specular = 0.5; + float Metallic = _Metallic; + float Smoothness = _Smoothness; + float Occlusion = temp_output_145_0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _CLEARCOAT + float CoatMask = 0; + float CoatSmoothness = 0; + #endif + + #if defined(_FLUORESCENCE) + float4 Fluorescence = 0; + float4 Absorbance = 0; + #endif + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = ShadowCoords; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + + #ifdef ASE_FOG + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzww; //TODO: Shuffle things in vertex streams so we get full RGBA color rather than RGBB here + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xyz, IN.dynamicLightmapUV.xy, IN.vertexSH, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, IN.vertexSH , inputData.normalWS); + #endif + + #else + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + #endif + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = Albedo; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + #if defined(_FLUORESCENCE) + surfaceData.fluorescence = Fluorescence; + surfaceData.absorbance = Absorbance; + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData); + #endif + + half4 color = UniversalFragmentPBR( inputData, surfaceData); + + #ifdef LIGHTMAP_ON + float3 MetalSpec = lerp(kDieletricSpec.rgb, surfaceData.albedo , surfaceData.metallic); + color.rgb += BakedSpecular * surfaceData.occlusion * MetalSpec * inputData.bakedGI.rgb; + #endif + + #ifdef _TRANSMISSION_ASE + { + float shadow = _TransmissionShadow; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; + color.rgb += Albedo * mainTransmission; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; + color.rgb += Albedo * transmission; + } + #endif + } + #endif + + #ifdef _TRANSLUCENCY_ASE + { + float shadow = _TransShadow; + float normal = _TransNormal; + float scattering = _TransScattering; + float direct = _TransDirect; + float ambient = _TransAmbient; + float strength = _TransStrength; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + + half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; + half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); + half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * mainTranslucency * strength; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 lightDir = light.direction + inputData.normalWS * normal; + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * translucency * strength; + } + #endif + } + #endif + + #ifdef _REFRACTION_ASE + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, IN.fogFactorAndVertexLight.x); + #endif + #endif + + color = Volumetrics( color, inputData.positionWS); + + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return color; + } + + ENDHLSL + } + + + Pass + { + + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #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" + + #pragma shader_feature_local_fragment _BRDFMAP + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + half4 EllipsoidPosArray[HitMatrixCount]; + float4 _BaseMap_ST; + float4 _Emission; + int _NumberOfHits; + float _CustomCubemap; + float _Refraction; + float _WireScale; + float _Metallic; + float _Smoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + float3 _LightDirection; + float3 _LightPosition; + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + float3 normalWS = TransformObjectToWorldDir(v.ase_normal); + + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + float2 vShadowOffsets = GetShadowOffsets( normalWS, lightDirectionWS ); + positionWS.xyz -= vShadowOffsets.y * lightDirectionWS.xyz * .01; + float4 clipPos = TransformObjectToHClip( float4( mul( unity_WorldToObject, float4( positionWS.xyz, 1.0 ) ).xyz, 1.0 ) ); + //float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + #if UNITY_REVERSED_Z + clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #else + clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #endif + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = clipPos; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + return 0; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + #pragma shader_feature_local_fragment _BRDFMAP + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + half4x4 EllipsoidPosArray[HitMatrixCount]; + float4 _BaseMap_ST; + float4 _Emission; + int _NumberOfHits; + float _CustomCubemap; + float _Refraction; + float _WireScale; + float _Metallic; + float _Smoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + + Pass + { + + Name "Meta" + Tags { "LightMode"="Meta" } + + Cull Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature _ EDITOR_VISUALIZATION + + #define SHADERPASS SHADERPASS_META + + #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/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #define ASE_NEEDS_VERT_NORMAL + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma shader_feature_local_fragment _BRDFMAP + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef EDITOR_VISUALIZATION + float4 VizUV : TEXCOORD2; + float4 LightCoord : TEXCOORD3; + #endif + float4 ase_texcoord4 : TEXCOORD4; + float4 ase_texcoord5 : TEXCOORD5; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + half4x4 EllipsoidPosArray[HitMatrixCount]; + float4 _BaseMap_ST; + float4 _Emission; + int _NumberOfHits; + float _CustomCubemap; + float _Refraction; + float _WireScale; + float _Metallic; + float _Smoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float3 ase_worldNormal = TransformObjectToWorldNormal(v.ase_normal); + o.ase_texcoord4.xyz = ase_worldNormal; + + o.ase_texcoord5.xy = v.texcoord0.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.w = 0; + o.ase_texcoord5.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.clipPos = MetaVertexPosition( v.vertex, v.texcoord1.xy, v.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); + + #ifdef EDITOR_VISUALIZATION + float2 VizUV = 0; + float4 LightCoord = 0; + UnityEditorVizData(v.vertex.xyz, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, VizUV, LightCoord); + o.VizUV = float4(VizUV, 0, 0); + o.LightCoord = LightCoord; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = o.clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float3 ase_worldNormal = IN.ase_texcoord4.xyz; + float3 normalizedWorldNormal = normalize( ase_worldNormal ); + float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - WorldPosition ); + ase_worldViewDir = SafeNormalize( ase_worldViewDir ); + float dotResult13 = dot( normalizedWorldNormal , ase_worldViewDir ); + float temp_output_89_0 = saturate( dotResult13 ); + float2 uv_BaseMap = IN.ase_texcoord5.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float4 tex2DNode8 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ); + float4 temp_output_14_0 = ( temp_output_89_0 * temp_output_89_0 * tex2DNode8 ); + + + float3 Albedo = temp_output_14_0.rgb; + float3 Emission = 0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = Albedo; + metaInput.Emission = Emission; + #ifdef EDITOR_VISUALIZATION + metaInput.VizUV = IN.VizUV.xy; + metaInput.LightCoord = IN.LightCoord; + #endif + + return MetaFragment(metaInput); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "BakedRaytrace" + Tags{ "LightMode" = "BakedRaytrace" } + HLSLPROGRAM + + /*ase_pragma_before*/ + + #define SHADERPASS SHADERPASS_RAYTRACE + + #include "UnityRaytracingMeshUtils.cginc" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #define _EMISSION + #pragma raytracing test + #pragma shader_feature_local __ _ALBEDOMULTIPLY_ON + #pragma shader_feature_local __ _EMISSION_ON + + /*ase_pragma*/ + + struct RayPayload + { + float4 color; + float3 dir; + }; + + struct AttributeData + { + float2 barycentrics; + }; + + struct Vertex + { + float2 texcoord; + float3 normal; + }; + + Texture2D _BaseMap; + SamplerState sampler_BaseMap; + + CBUFFER_START( UnityPerMaterial ) + /*ase_srp_batcher*/ + Texture2D _EmissionMap; + SamplerState sampler_EmissionMap; + + float4 _EmissionColor; + float4 _BaseMap_ST; + float _BakedMutiplier = 1; + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + //https://coty.tips/raytracing-in-unity/ + [shader("closesthit")] + void MyClosestHit(inout RayPayload payload, + AttributeData attributes : SV_IntersectionAttributes) { + + payload.color = float4(0,0,0,1); //Intializing + payload.dir = float3(1,0,0); + + // #if _EMISSION_ON + uint2 launchIdx = DispatchRaysIndex(); + // ShadingData shade = getShadingData( PrimitiveIndex(), attribs ); + + uint primitiveIndex = PrimitiveIndex(); + uint3 triangleIndicies = UnityRayTracingFetchTriangleIndices(primitiveIndex); + Vertex v0, v1, v2; + + v0.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.x, kVertexAttributeTexCoord0); + v1.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.y, kVertexAttributeTexCoord0); + v2.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.z, kVertexAttributeTexCoord0); + + // v0.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.x, kVertexAttributeNormal); + // v1.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.y, kVertexAttributeNormal); + // v2.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.z, kVertexAttributeNormal); + + float3 barycentrics = float3(1.0 - attributes.barycentrics.x - attributes.barycentrics.y, attributes.barycentrics.x, attributes.barycentrics.y); + + Vertex vInterpolated; + vInterpolated.texcoord = v0.texcoord * barycentrics.x + v1.texcoord * barycentrics.y + v2.texcoord * barycentrics.z; + //TODO: Extract normal direction to ignore the backside of emissive objects + //vInterpolated.normal = v0.normal * barycentrics.x + v1.normal * barycentrics.y + v2.normal * barycentrics.z; + // if ( dot(vInterpolated.normal, float3(1,0,0) < 0) ) payload.color = float4(0,10,0,1) ; + // else payload.color = float4(10,0,0,1) ; + + //TODO: Figure out how to tie Amplify into using Texture2d and SamplerState instead of the bundled sampler2D. Forcing names for now. + //#if _ALBEDOMULTIPLY_ON + float4 albedo = float4(_BaseMap.SampleLevel(sampler_BaseMap, vInterpolated.texcoord.xy * _BaseMap_ST.xy + _BaseMap_ST.zw, 0 ).rgb , 1) ; + // #else + // float4 albedo = float4(1,1,1,1); + // #endif + + payload.color = float4( (_EmissionMap.SampleLevel(sampler_EmissionMap, vInterpolated.texcoord * _BaseMap_ST.xy + _BaseMap_ST.zw,0) ).rgb * _EmissionColor.rgb * albedo.rgb * _BakedMutiplier , 1 ); + // #else + // payload.color = float4(0,0,0,1); + + // #endif + } + ENDHLSL + + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend One Zero, One Zero + ColorMask RGBA + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_2D + + #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" + + #define ASE_NEEDS_VERT_NORMAL + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma shader_feature_local_fragment _BRDFMAP + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_texcoord2 : TEXCOORD2; + float4 ase_texcoord3 : TEXCOORD3; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + half4x4 EllipsoidPosArray[HitMatrixCount]; + float4 _BaseMap_ST; + float4 _Emission; + int _NumberOfHits; + float _CustomCubemap; + float _Refraction; + float _WireScale; + float _Metallic; + float _Smoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID( v ); + UNITY_TRANSFER_INSTANCE_ID( v, o ); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + float3 ase_worldNormal = TransformObjectToWorldNormal(v.ase_normal); + o.ase_texcoord2.xyz = ase_worldNormal; + + o.ase_texcoord3.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord2.w = 0; + o.ase_texcoord3.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float3 ase_worldNormal = IN.ase_texcoord2.xyz; + float3 normalizedWorldNormal = normalize( ase_worldNormal ); + float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - WorldPosition ); + ase_worldViewDir = SafeNormalize( ase_worldViewDir ); + float dotResult13 = dot( normalizedWorldNormal , ase_worldViewDir ); + float temp_output_89_0 = saturate( dotResult13 ); + float2 uv_BaseMap = IN.ase_texcoord3.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float4 tex2DNode8 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ); + float4 temp_output_14_0 = ( temp_output_89_0 * temp_output_89_0 * tex2DNode8 ); + + + float3 Albedo = temp_output_14_0.rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + half4 color = half4( Albedo, Alpha ); + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + return color; + } + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormals" } + + ZWrite On + Blend One Zero + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/Color.hlsl" + + #pragma shader_feature_local_fragment _BRDFMAP + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + half4x4 EllipsoidPosArray[HitMatrixCount]; + float4 _BaseMap_ST; + float4 _Emission; + int _NumberOfHits; + float _CustomCubemap; + float _Refraction; + float _WireScale; + float _Metallic; + float _Smoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal( v.ase_normal ); + float4 tangentWS = float4(TransformObjectToWorldDir( v.ase_tangent.xyz), v.ase_tangent.w); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + float3 WorldNormal = IN.worldNormal; + float4 WorldTangent = IN.worldTangent; + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float3 Normal = float3(0, 0, 1); + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + return half4(packedNormalWS, 0.0); + #else + + #if defined(_NORMALMAP) + #if _NORMAL_DROPOFF_TS + float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz); + float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz)); + #elif _NORMAL_DROPOFF_OS + float3 normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + float3 normalWS = Normal; + #endif + #else + float3 normalWS = WorldNormal; + #endif + + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + #endif + } + ENDHLSL + } + + + Pass + { + + Name "GBuffer" + Tags { "LightMode"="UniversalGBuffer" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM +#define _NORMAL_DROPOFF_TS 1#pragma multi_compile_fog#define ASE_FOG 1#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED#define _DISABLE_LIGHTMAPS#define _EMISSION#define ASE_SRP_VERSION 999999#define ASE_USING_SAMPLING_MACROS 1 +#if FALSE + #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_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 _ _MIXED_LIGHTING_SUBTRACTIVE + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _GBUFFER_NORMALS_OCT + //#pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile _ _RENDER_PASS_ENABLED + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_GBUFFER + + #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/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + #pragma shader_feature_local_fragment _BRDFMAP + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + float4 ase_texcoord9 : TEXCOORD9; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + half4x4 EllipsoidPosArray[HitMatrixCount]; + float4 _BaseMap_ST; + float4 _Emission; + int _NumberOfHits; + float _CustomCubemap; + float _Refraction; + float _WireScale; + float _Metallic; + float _Smoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + TEXTURECUBE(_Cubemap); + SAMPLER(sampler_Cubemap); + TEXTURE2D(_WireColor); + SAMPLER(sampler_WireColor); + + + half2 PosespaceImpacts_A( float3 Posespace ) + { + return GetClosestImpactUV( Posespace, EllipsoidPosArray , _NumberOfHits ); + } + + half2 SampleHitTex( half2 ImpactsUV ) + { + return SampleHitTexture(ImpactsUV); + } + + float3 MyCustomExpression( float3 viewDirectionWS, float blur ) + { + return DecodeHDREnvironment(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0 , viewDirectionWS, blur*UNITY_SPECCUBE_LOD_STEPS), unity_SpecCube0_HDR); + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xyz = v.texcoord.xyz; + o.ase_texcoord9.xyz = v.texcoord1.xyz; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.w = 0; + o.ase_texcoord9.w = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + FragmentOutput frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #else + ShadowCoords = float4(0, 0, 0, 0); + #endif + + + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float3 normalizedWorldNormal = normalize( WorldNormal ); + float dotResult13 = dot( normalizedWorldNormal , WorldViewDirection ); + float temp_output_89_0 = saturate( dotResult13 ); + float2 uv_BaseMap = IN.ase_texcoord8.xyz.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float4 tex2DNode8 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ); + float4 temp_output_14_0 = ( temp_output_89_0 * temp_output_89_0 * tex2DNode8 ); + + float3 texCoord31 = IN.ase_texcoord9.xyz; + texCoord31.xy = IN.ase_texcoord9.xyz.xy * float2( 1,1 ) + float2( 0,0 ); + half3 Posespace29 = texCoord31; + half2 localPosespaceImpacts_A29 = PosespaceImpacts_A( Posespace29 ); + half2 ImpactsUV137 = localPosespaceImpacts_A29; + half2 localSampleHitTex137 = SampleHitTex( ImpactsUV137 ); + float temp_output_144_0 = min( (localSampleHitTex137).y , ( 1.0 - floor( (localPosespaceImpacts_A29).x ) ) ); + float3 temp_output_66_0 = refract( -WorldViewDirection , normalizedWorldNormal , _Refraction ); + float3 viewDirectionWS58 = temp_output_66_0; + float temp_output_65_0 = ( 1.0 - temp_output_89_0 ); + float blur58 = temp_output_65_0; + float3 localMyCustomExpression58 = MyCustomExpression( viewDirectionWS58 , blur58 ); + float3 texCoord5 = IN.ase_texcoord9.xyz; + texCoord5.xy = IN.ase_texcoord9.xyz.xy * float2( 1,1 ) + float2( 0,0 ); + float4 tex2DNode7 = SAMPLE_TEXTURE2D( _WireColor, sampler_WireColor, ( texCoord5 * _WireScale ).xy ); + float4 blendOpSrc129 = tex2DNode8; + float4 blendOpDest129 = tex2DNode7; + float4 lerpBlendMode129 = lerp(blendOpDest129,abs( blendOpSrc129 - blendOpDest129 ),saturate( (0.0 + (temp_output_65_0 - 0.48) * (1.0 - 0.0) / (1.0 - 0.48)) )); + float temp_output_145_0 = ( 1.0 - temp_output_144_0 ); + float4 lerpResult160 = lerp( (( _CustomCubemap )?( SAMPLE_TEXTURECUBE_LOD( _Cubemap, sampler_Cubemap, temp_output_66_0, temp_output_65_0 ) ):( float4( localMyCustomExpression58 , 0.0 ) )) , ( ( lerpBlendMode129 + ( (( _CustomCubemap )?( SAMPLE_TEXTURECUBE_LOD( _Cubemap, sampler_Cubemap, temp_output_66_0, temp_output_65_0 ) ):( float4( localMyCustomExpression58 , 0.0 ) )) * temp_output_14_0 ) ) * temp_output_145_0 * _Emission ) , min( temp_output_145_0 , tex2DNode7.a )); + + float3 Albedo = temp_output_14_0.rgb; + float3 Normal = float3(0, 0, 1); + float3 Emission = ( float4( ( localSampleHitTex137 * temp_output_144_0 ), 0.0 , 0.0 ) + lerpResult160 ).rgb; + float3 Specular = 0.5; + float Metallic = _Metallic; + float Smoothness = _Smoothness; + float Occlusion = temp_output_145_0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = IN.clipPos; + inputData.shadowCoord = ShadowCoords; + + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + #else + inputData.normalWS = WorldNormal; + #endif + + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + inputData.viewDirectionWS = SafeNormalize( WorldViewDirection ); + + + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(WorldPosition, 1.0), IN.fogFactorAndVertexLight.x); + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.clipPos, + Albedo, + Specular, + inputData.normalWS, + Metallic, + Occlusion, + Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData + (Albedo, Metallic, Specular, Smoothness, Alpha, brdfData); + + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + half4 color; + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + color.a = Alpha; + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + #pragma shader_feature_local_fragment _BRDFMAP + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + half4x4 EllipsoidPosArray[HitMatrixCount]; + float4 _BaseMap_ST; + float4 _Emission; + int _NumberOfHits; + float _CustomCubemap; + float _Refraction; + float _WireScale; + float _Metallic; + float _Smoothness; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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" + + #pragma shader_feature_local_fragment _BRDFMAP + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + half4x4 EllipsoidPosArray[HitMatrixCount]; + float4 _BaseMap_ST; + float4 _Emission; + int _NumberOfHits; + float _CustomCubemap; + float _Refraction; + float _WireScale; + float _Metallic; + float _Smoothness; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphLitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +2377;282;1920;719;920.551;1386.058;1;True;True +Node;AmplifyShaderEditor.CommentaryNode;26;-831.1582,-1271.949;Inherit;False;1130.562;520.1016;Posspace impacts;8;141;139;137;29;31;146;149;154;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;140;-250.5171,-867.0173;Inherit;False;527.1998;186.4003;Clip;3;144;143;142;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.SimpleMinOpNode;165;841.048,-143.3738;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.PowerNode;131;-566.3386,-757.3566;Inherit;False;True;2;0;FLOAT;0;False;1;FLOAT;5;False;1;FLOAT;0 +Node;AmplifyShaderEditor.OneMinusNode;145;133.857,-646.8608;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;19;-429.9197,844.2775;Inherit;False;Constant;_Float0;Float 0;4;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.Matrix4X4Node;154;-808.881,-1025.135;Inherit;False;Property;EllipsoidPosArray[HitMatrixCount];EllipsoidPosArray;12;0;Create;False;0;0;0;True;0;False;1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;0;1;FLOAT4x4;0 +Node;AmplifyShaderEditor.RangedFloatNode;16;-246.9198,844.2775;Inherit;False;Property;_DisplacementAmount;Displacement Amount;5;0;Create;True;0;0;0;False;0;False;0;0.004;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;87;-1090.788,52.81657;Inherit;False;Property;_WireScale;Wire Scale;3;0;Create;True;0;0;0;False;0;False;3;2.3;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;90;-718.9076,-50.80401;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.LerpOp;160;751.3168,-256.9434;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TexturePropertyNode;146;80.82147,-1235.564;Inherit;True;Property;_HitRamp;Hit Ramp;10;2;[NoScaleOffset];[SingleLineTexture];Fetch;True;0;0;0;True;0;False;None;76fcc1011f697434db1b4dd61a9f40df;False;black;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.FloorOpNode;142;-200.5166,-791.617;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RelayNode;115;362.0261,-524.0076;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;31;-757.2919,-1179.52;Inherit;False;1;-1;3;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;79;669.2932,-745.8077;Inherit;False;Property;_Smoothness;Smoothness;7;0;Create;True;0;0;0;False;0;False;0;0.854;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;68;-1445.744,-547.5814;Inherit;False;Property;_Refraction;Refraction;6;0;Create;True;0;0;0;False;0;False;0.884;0.981;0.5;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.TexturePropertyNode;135;1397.647,105.2692;Inherit;True;Property;g_tBRDFMap;BRDF map;1;1;[NoScaleOffset];Fetch;False;0;0;0;True;0;False;None;de79bcbe6f99c48da9238822c4300e8f;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.BlendOpsNode;129;-38.41203,30.29977;Inherit;True;Difference;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;1;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;123;464.7832,-647.4188;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.BreakToComponentsNode;138;258.4911,-978.3395;Inherit;False;FLOAT;1;0;FLOAT;0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 +Node;AmplifyShaderEditor.WorldNormalVector;35;-1472.088,-1092.346;Inherit;False;True;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.ToggleSwitchNode;161;-521.785,-316.5437;Inherit;False;Property;_CustomCubemap;Custom Cubemap;14;0;Create;True;0;0;0;False;0;False;1;True;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.ViewDirInputsCoordNode;12;-1462.103,-767.708;Inherit;False;World;True;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.IntNode;149;-727.9803,-885.525;Inherit;False;Property;_NumberOfHits;_NumberOfHits;11;1;[HideInInspector];Create;True;0;0;0;True;0;False;0;0;False;0;1;INT;0 +Node;AmplifyShaderEditor.SwizzleNode;141;-224.691,-986.3836;Inherit;False;FLOAT;0;1;2;3;1;0;FLOAT2;0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.CustomExpressionNode;58;-805.3964,-429.2491;Inherit;False;return DecodeHDREnvironment(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0 , viewDirectionWS, blur*UNITY_SPECCUBE_LOD_STEPS), unity_SpecCube0_HDR)@;3;Create;2;True;viewDirectionWS;FLOAT3;0,0,0;In;;Inherit;False;True;blur;FLOAT;0;In;;Inherit;False;My Custom Expression;False;False;0;;False;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.RefractOpVec;66;-1090.668,-636.2891;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.OneMinusNode;143;-56.51789,-793.217;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.NegateNode;70;-1248.481,-668.7733;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.WorldNormalVector;81;-1290.717,-947.2798;Inherit;False;True;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.DotProductOpNode;13;-1054.969,-801.1615;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.OneMinusNode;166;426.9427,-783.6636;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TFHCRemapNode;132;-439.6486,-633.1974;Inherit;True;5;0;FLOAT;0;False;1;FLOAT;0.48;False;2;FLOAT;1;False;3;FLOAT;0;False;4;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerStateNode;109;-403.2362,-741.7126;Inherit;False;4;1;0;1;-1;None;1;0;SAMPLER2D;;False;1;SAMPLERSTATE;0 +Node;AmplifyShaderEditor.NormalVertexDataNode;71;-1468.606,-932.2385;Inherit;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.CustomExpressionNode;29;-400.6082,-1077.482;Half;False;return GetClosestImpactUV( Posespace, EllipsoidPosArray , _NumberOfHits )@;2;Create;1;True;Posespace;FLOAT3;0,0,0;In;;Float;False;PosespaceImpacts_A;False;False;0;7b6b6173356a02044990adfdcb567f25;False;1;0;FLOAT3;0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.OneMinusNode;65;-840.4833,-712.3312;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;24;-938.399,502.4214;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.OneMinusNode;122;93.36023,-192.3652;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;10;-864.9715,125.062;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;3;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SamplerNode;15;-740.3387,746.6892;Inherit;True;Property;_DisplacementMap;DisplacementMap;4;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SaturateNode;89;-824.1046,-775.8494;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;80;669.2932,-823.8077;Inherit;False;Property;_Metallic;Metallic;8;0;Create;True;0;0;0;False;0;False;0;0.562;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;7;-492.0483,58.95336;Inherit;True;Property;_WireColor;WireColor;2;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;-1;07e40fb4bdc07784493f741d9447821a;a22f1ecdacadc2b40aeebd97493732ad;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SaturateNode;133;-159.6486,-489.1974;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;8;-502.8986,-120.0093;Inherit;True;Property;_BaseMap;_BaseMap;0;0;Create;True;0;0;0;False;0;False;-1;e298abdcd2d10894fba4930f7890c1fc;76e0dfed0d3b7914983be74f711467f6;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleAddOpNode;21;22.01736,742.7548;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.PosVertexDataNode;20;-205.5099,599.1859;Inherit;False;0;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;78;113.4936,-106.5526;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;5;-1364.524,347.8478;Inherit;False;1;-1;3;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SamplerNode;157;-859.325,-300.5988;Inherit;True;Property;_Cubemap;Cubemap;13;0;Create;True;0;0;0;False;0;False;-1;None;115f13f0a868a454e9cdcee7cf7dba60;True;0;False;white;LockedToCube;False;Object;-1;MipLevel;Cube;8;0;SAMPLERCUBE;;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMinOpNode;144;124.6821,-817.0174;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;18;-351.9198,752.2774;Inherit;False;2;0;COLOR;0.5,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;17;-158.9197,753.2774;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.ColorNode;134;292.5822,280.2836;Inherit;False;Property;_Emission;Emission;9;1;[HDR];Create;True;0;0;0;False;0;False;1,1,1,1;1,1,1,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SwizzleNode;113;-80.55261,-575.9805;Inherit;False;FLOAT;0;1;2;3;1;0;FLOAT2;0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleTimeNode;22;-1206.77,524.5335;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;9;316.6104,55.69166;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TFHCRemapNode;53;-1750.74,-94.97852;Inherit;True;5;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0.3;False;3;FLOAT;0;False;4;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SwizzleNode;139;-8.460827,-961.1543;Inherit;False;FLOAT;3;1;2;3;1;0;FLOAT2;0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;114;495.3173,-15.92235;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.CustomExpressionNode;137;-128.6731,-1065.85;Half;False;return SampleHitTexture(ImpactsUV)@;2;Create;1;True;ImpactsUV;FLOAT2;0,0;In;;Inherit;False;SampleHitTex;False;False;0;7b6b6173356a02044990adfdcb567f25;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.WorldPosInputsNode;51;731.1708,483.9148;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SimpleAddOpNode;116;953.6899,-310.2614;Inherit;False;2;2;0;FLOAT2;0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SaturateNode;85;-1383.562,-46.49241;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.StaticSwitch;136;1423.192,7.304076;Inherit;False;Property;BRDFMAP1;Enable BRDF map;0;0;Create;False;0;0;0;True;0;False;0;0;0;False;_BRDFMAP;Toggle;2;Key0;Key1;Create;True;False;Fragment;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;14;-166.6766,-262.7515;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;102;980.6183,-516.1838;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;105;980.6183,-516.1838;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormals;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;103;980.6183,-516.1838;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;100;1279.686,-514.3459;Half;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;SLZ/Nullman;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;23;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalForward;False;False;2;Include;;False;;Native;Include;Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl;False;;Custom;Hidden/InternalErrorShader;0;0;Standard;48;Workflow;1;0;Surface;0;0; Refraction Model;0;0; Blend;0;0;Two Sided;1;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Transmission;0;0; Transmission Shadow;0.5,False,-1;0;Translucency;0;0; Translucency Strength;1,False,-1;0; Normal Distortion;0.5,False,-1;0; Scattering;2,False,-1;0; Direct;0.9,False,-1;0; Ambient;0.1,False,-1;0; Shadow;0.5,False,-1;0;Cast Shadows;1;0; Use Shadow Threshold;0;0;Receive Shadows;1;0;GPU Instancing;0;637871337383113979;LOD CrossFade;0;637836073116476184;Built-in Fog;1;0;Lightmaps;0;637946547281780365;Volumetrics;1;0;Decals;0;637871337399645676;Screen Space Occlusion;1;0;Reflection Probe Blend/Projection;1;0;Light Layers;0;637871337407115445;_FinalColorxAlpha;0;0;Meta Pass;1;0;GBuffer Pass;0;0;Override Baked GI;0;0;Extra Pre Pass;0;0;DOTS Instancing;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Write Depth;0;0; Early Z;0;0;Vertex Position,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;0;0;Fluorescence;0;0;0;10;False;True;True;True;True;True;True;True;True;True;False;;True;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;104;980.6183,-516.1838;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;101;980.6183,-516.1838;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;108;980.6183,-516.1838;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;107;980.6183,-516.1838;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;99;980.6183,-527.7669;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;106;980.6183,-516.1838;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +WireConnection;165;0;145;0 +WireConnection;165;1;7;4 +WireConnection;131;0;65;0 +WireConnection;145;0;144;0 +WireConnection;160;0;161;0 +WireConnection;160;1;114;0 +WireConnection;160;2;165;0 +WireConnection;142;0;141;0 +WireConnection;115;0;145;0 +WireConnection;129;0;8;0 +WireConnection;129;1;7;0 +WireConnection;129;2;133;0 +WireConnection;123;0;137;0 +WireConnection;123;1;144;0 +WireConnection;161;0;58;0 +WireConnection;161;1;157;0 +WireConnection;141;0;29;0 +WireConnection;58;0;66;0 +WireConnection;58;1;65;0 +WireConnection;66;0;70;0 +WireConnection;66;1;81;0 +WireConnection;66;2;68;0 +WireConnection;143;0;142;0 +WireConnection;70;0;12;0 +WireConnection;13;0;81;0 +WireConnection;13;1;12;0 +WireConnection;132;0;65;0 +WireConnection;29;0;31;0 +WireConnection;65;0;89;0 +WireConnection;24;0;5;0 +WireConnection;24;1;22;0 +WireConnection;10;0;5;0 +WireConnection;10;1;87;0 +WireConnection;15;1;24;0 +WireConnection;89;0;13;0 +WireConnection;7;1;10;0 +WireConnection;133;0;132;0 +WireConnection;21;0;20;0 +WireConnection;21;1;17;0 +WireConnection;78;0;161;0 +WireConnection;78;1;14;0 +WireConnection;157;1;66;0 +WireConnection;157;2;65;0 +WireConnection;144;0;139;0 +WireConnection;144;1;143;0 +WireConnection;18;0;15;0 +WireConnection;18;1;19;0 +WireConnection;17;0;18;0 +WireConnection;17;1;16;0 +WireConnection;113;0;29;0 +WireConnection;9;0;129;0 +WireConnection;9;1;78;0 +WireConnection;53;0;89;0 +WireConnection;139;0;137;0 +WireConnection;114;0;9;0 +WireConnection;114;1;115;0 +WireConnection;114;2;134;0 +WireConnection;137;0;29;0 +WireConnection;116;0;123;0 +WireConnection;116;1;160;0 +WireConnection;85;0;53;0 +WireConnection;14;0;89;0 +WireConnection;14;1;89;0 +WireConnection;14;2;8;0 +WireConnection;100;0;14;0 +WireConnection;100;2;116;0 +WireConnection;100;3;80;0 +WireConnection;100;4;79;0 +WireConnection;100;5;115;0 +ASEEND*/ +//CHKSM=B89AE597CED47D4D90D5FDEE67FCFACD2DDB7E0B \ No newline at end of file diff --git a/Assets/SLZShaders/NullShader.shader.meta b/Assets/SLZShaders/NullShader.shader.meta new file mode 100644 index 0000000..87333d0 --- /dev/null +++ b/Assets/SLZShaders/NullShader.shader.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b2e867ce46fe95046aaceb0155a651ad +ShaderImporter: + externalObjects: {} + defaultTextures: + - _BaseMap: {fileID: 2800000, guid: e298abdcd2d10894fba4930f7890c1fc, type: 3} + - _WireColor: {fileID: 2800000, guid: 07e40fb4bdc07784493f741d9447821a, type: 3} + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/OpaqueHologram.shader b/Assets/SLZShaders/OpaqueHologram.shader new file mode 100644 index 0000000..56a5704 --- /dev/null +++ b/Assets/SLZShaders/OpaqueHologram.shader @@ -0,0 +1,3321 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/Hologram Depth fade" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [ASEBegin]_BaseMap("Base Map", 2D) = "white" {} + _DepthFader("Depth Fader", Float) = 0.15 + [NoScaleOffset]_BumpMap("Bump Map", 2D) = "bump" {} + [HDR]_HologramEdgeColor("Hologram Edge Color", Color) = (0.2803489,0.5694646,0.9433962,0.09019608) + [NoScaleOffset]_MetallicGlossMap("Metallic, AO, Smoothness", 2D) = "white" {} + _Noise("Noise", Range( 0 , 1)) = 0.136 + _ScanlineSize("ScanlineSize", Float) = 1.5 + [ASEEnd][HDR]_EmissionColor("Emission tint", Color) = (1,1,1,1) + + [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) = "" {} + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + + + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry+100" } + Cull Back + ZWrite On + ZTest LEqual + Offset 0,0 + AlphaToMask Off + + HLSLINCLUDE + #pragma target 5.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForward" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_DEPTH_WRITE_ON + #define _DISABLE_LIGHTMAPS + #define _DISABLE_SSAO + #pragma multi_compile_instancing + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_FORWARD + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.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.core/ShaderLibrary/TextureStack.hlsl" + + #define ASE_NEEDS_FRAG_SCREEN_POSITION + #define ASE_NEEDS_FRAG_WORLD_TANGENT + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_BITANGENT + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.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.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + float4 ase_texcoord9 : TEXCOORD9; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _EmissionColor; + float4 _HologramEdgeColor; + float _Noise; + float _ScanlineSize; + float _DepthFader; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + TEXTURE2D(_BumpMap); + SAMPLER(sampler_BumpMap); + TEXTURE2D(_MetallicGlossMap); + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g34( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + inline float3 MyCustomExpression( half4 In0 ) + { + return UnpackNormal(In0);; + } + + real3 ASESafeNormalize(float3 inVec) + { + real dp3 = max(FLT_MIN, dot(inVec, inVec)); + return inVec* rsqrt( dp3); + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xy = v.texcoord.xy; + o.ase_texcoord9 = v.vertex; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + #endif + + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) || defined(ASE_TERRAIN_INSTANCING) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 texCoord26 = IN.ase_texcoord8.xy * float2( 1,1 ) + float2( 0,0 ); + float4 tex2DNode7 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, texCoord26 ); + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( ScreenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float2 screenUV27_g34 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g34 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g34 = GetScreenNoiseRGBASlice27_g34( screenUV27_g34 , offsetFrame27_g34 ); + float4 temp_output_198_0 = localGetScreenNoiseRGBASlice27_g34; + float4 temp_cast_0 = (0.5).xxxx; + float4 temp_output_78_0 = ( ( temp_output_198_0 - temp_cast_0 ) * _Noise ); + float4 temp_output_91_0 = ( tex2DNode7 + temp_output_78_0 ); + + float4 In02_g33 = SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, texCoord26 ); + float3 localMyCustomExpression2_g33 = MyCustomExpression( In02_g33 ); + float3 temp_output_58_0 = localMyCustomExpression2_g33; + + float3 tanToWorld0 = float3( WorldTangent.x, WorldBiTangent.x, WorldNormal.x ); + float3 tanToWorld1 = float3( WorldTangent.y, WorldBiTangent.y, WorldNormal.y ); + float3 tanToWorld2 = float3( WorldTangent.z, WorldBiTangent.z, WorldNormal.z ); + float3 tanNormal56 = temp_output_58_0; + float3 worldNormal56 = float3(dot(tanToWorld0,tanNormal56), dot(tanToWorld1,tanNormal56), dot(tanToWorld2,tanNormal56)); + float3 normalizeResult85 = ASESafeNormalize( WorldViewDirection ); + float dotResult53 = dot( worldNormal56 , normalizeResult85 ); + float temp_output_54_0 = ( 1.0 - dotResult53 ); + float4 temp_output_87_0 = ( ( temp_output_54_0 * temp_output_54_0 * temp_output_54_0 ) * _HologramEdgeColor ); + float4 temp_cast_4 = (0.5).xxxx; + float temp_output_65_0 = ( ( ase_grabScreenPosNorm.g * ( _ScreenParams.y / _ScanlineSize ) ) % 2.0 ); + float4 temp_cast_6 = (0.5).xxxx; + + float4 tex2DNode86 = SAMPLE_TEXTURE2D( _MetallicGlossMap, sampler_BaseMap, texCoord26 ); + + float lerpResult96 = lerp( temp_output_65_0 , 1.0 , saturate( ( dotResult53 - 0.2 ) )); + + float4 unityObjectToClipPos145 = TransformWorldToHClip(TransformObjectToWorld(IN.ase_texcoord9.xyz)); + float temp_output_14_0 = ( unityObjectToClipPos145.w + ( (temp_output_198_0).w * _DepthFader ) ); + float lerpResult183 = lerp( ( ( (temp_output_198_0).w - 1.0 ) * 2.0 ) , 0.5 , ( _EmissionColor.a * tex2DNode7.a )); + + float3 Albedo = temp_output_91_0.rgb; + float3 Normal = temp_output_58_0; + float3 Emission = ( _EmissionColor * ( ( temp_output_87_0 * _HologramEdgeColor.a ) + ( ( temp_output_87_0 + temp_output_78_0 ) * temp_output_65_0 * temp_output_91_0 ) ) ).rgb; +#if 0 + float3 BakedEmission = _HologramEdgeColor.rgb; +#endif + float3 Specular = 0.5; + float Metallic = tex2DNode86.r; + float Smoothness = tex2DNode86.b; + float Occlusion = ( tex2DNode86.g * lerpResult96 ); + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = ( ( ( 1.0 - ( temp_output_14_0 * _ZBufferParams.w ) ) / ( temp_output_14_0 * _ZBufferParams.z ) ) * ceil( lerpResult183 ) ); + #endif + + #ifdef _CLEARCOAT + float CoatMask = 0; + float CoatSmoothness = 0; + #endif + + #if defined(_FLUORESCENCE) + float4 Fluorescence = 0; + float4 Absorbance = 0; + #endif + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = ShadowCoords; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + + #ifdef ASE_FOG + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzww; //TODO: Shuffle things in vertex streams so we get full RGBA color rather than RGBB here + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xyz, IN.dynamicLightmapUV.xy, IN.vertexSH, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, IN.vertexSH , inputData.normalWS); + #endif + + #else + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + #endif + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = Albedo; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + #if defined(_FLUORESCENCE) + surfaceData.fluorescence = Fluorescence; + surfaceData.absorbance = Absorbance; + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData); + #endif + + half4 color = UniversalFragmentPBR( inputData, surfaceData); + + #ifdef LIGHTMAP_ON + float3 MetalSpec = lerp(kDieletricSpec.rgb, surfaceData.albedo , surfaceData.metallic); + color.rgb += BakedSpecular * surfaceData.occlusion * MetalSpec * inputData.bakedGI.rgb; + #endif + + #ifdef _TRANSMISSION_ASE + { + float shadow = _TransmissionShadow; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; + color.rgb += Albedo * mainTransmission; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; + color.rgb += Albedo * transmission; + } + #endif + } + #endif + + #ifdef _TRANSLUCENCY_ASE + { + float shadow = _TransShadow; + float normal = _TransNormal; + float scattering = _TransScattering; + float direct = _TransDirect; + float ambient = _TransAmbient; + float strength = _TransStrength; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + + half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; + half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); + half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * mainTranslucency * strength; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 lightDir = light.direction + inputData.normalWS * normal; + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * translucency * strength; + } + #endif + } + #endif + + #ifdef _REFRACTION_ASE + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, IN.fogFactorAndVertexLight.x); + #endif + #endif + + color = Volumetrics( color, inputData.positionWS); + + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return color; + } + + ENDHLSL + } + + + Pass + { + + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_DEPTH_WRITE_ON + #define _DISABLE_LIGHTMAPS + #define _DISABLE_SSAO + #pragma multi_compile_instancing + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_texcoord2 : TEXCOORD2; + float4 ase_texcoord3 : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _EmissionColor; + float4 _HologramEdgeColor; + float _Noise; + float _ScanlineSize; + float _DepthFader; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g34( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + + float3 _LightDirection; + float3 _LightPosition; + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord3 = screenPos; + + o.ase_texcoord2 = v.vertex; + o.ase_texcoord4.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + float3 normalWS = TransformObjectToWorldDir(v.ase_normal); + + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + float2 vShadowOffsets = GetShadowOffsets( normalWS, lightDirectionWS ); + positionWS.xyz -= vShadowOffsets.y * lightDirectionWS.xyz * .01; + float4 clipPos = TransformObjectToHClip( float4( mul( unity_WorldToObject, float4( positionWS.xyz, 1.0 ) ).xyz, 1.0 ) ); + //float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + #if UNITY_REVERSED_Z + clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #else + clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #endif + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = clipPos; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float4 unityObjectToClipPos145 = TransformWorldToHClip(TransformObjectToWorld(IN.ase_texcoord2.xyz)); + float4 screenPos = IN.ase_texcoord3; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float2 screenUV27_g34 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g34 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g34 = GetScreenNoiseRGBASlice27_g34( screenUV27_g34 , offsetFrame27_g34 ); + float4 temp_output_198_0 = localGetScreenNoiseRGBASlice27_g34; + float temp_output_14_0 = ( unityObjectToClipPos145.w + ( (temp_output_198_0).w * _DepthFader ) ); + float2 texCoord26 = IN.ase_texcoord4.xy * float2( 1,1 ) + float2( 0,0 ); + float4 tex2DNode7 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, texCoord26 ); + float lerpResult183 = lerp( ( ( (temp_output_198_0).w - 1.0 ) * 2.0 ) , 0.5 , ( _EmissionColor.a * tex2DNode7.a )); + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = ( ( ( 1.0 - ( temp_output_14_0 * _ZBufferParams.w ) ) / ( temp_output_14_0 * _ZBufferParams.z ) ) * ceil( lerpResult183 ) ); + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + return 0; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_DEPTH_WRITE_ON + #define _DISABLE_LIGHTMAPS + #define _DISABLE_SSAO + #pragma multi_compile_instancing + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_texcoord2 : TEXCOORD2; + float4 ase_texcoord3 : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _EmissionColor; + float4 _HologramEdgeColor; + float _Noise; + float _ScanlineSize; + float _DepthFader; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g34( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord3 = screenPos; + + o.ase_texcoord2 = v.vertex; + o.ase_texcoord4.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float4 unityObjectToClipPos145 = TransformWorldToHClip(TransformObjectToWorld(IN.ase_texcoord2.xyz)); + float4 screenPos = IN.ase_texcoord3; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float2 screenUV27_g34 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g34 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g34 = GetScreenNoiseRGBASlice27_g34( screenUV27_g34 , offsetFrame27_g34 ); + float4 temp_output_198_0 = localGetScreenNoiseRGBASlice27_g34; + float temp_output_14_0 = ( unityObjectToClipPos145.w + ( (temp_output_198_0).w * _DepthFader ) ); + float2 texCoord26 = IN.ase_texcoord4.xy * float2( 1,1 ) + float2( 0,0 ); + float4 tex2DNode7 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, texCoord26 ); + float lerpResult183 = lerp( ( ( (temp_output_198_0).w - 1.0 ) * 2.0 ) , 0.5 , ( _EmissionColor.a * tex2DNode7.a )); + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = ( ( ( 1.0 - ( temp_output_14_0 * _ZBufferParams.w ) ) / ( temp_output_14_0 * _ZBufferParams.z ) ) * ceil( lerpResult183 ) ); + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "BakedRaytrace" + Tags{ "LightMode" = "BakedRaytrace" } + HLSLPROGRAM + + /*ase_pragma_before*/ + + #define SHADERPASS SHADERPASS_RAYTRACE + + #include "UnityRaytracingMeshUtils.cginc" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #define _EMISSION + #pragma raytracing test + #pragma shader_feature_local __ _ALBEDOMULTIPLY_ON + #pragma shader_feature_local __ _EMISSION_ON + + /*ase_pragma*/ + + struct RayPayload + { + float4 color; + float3 dir; + }; + + struct AttributeData + { + float2 barycentrics; + }; + + struct Vertex + { + float2 texcoord; + float3 normal; + }; + + Texture2D _BaseMap; + SamplerState sampler_BaseMap; + + CBUFFER_START( UnityPerMaterial ) + /*ase_srp_batcher*/ + Texture2D _EmissionMap; + SamplerState sampler_EmissionMap; + + float4 _EmissionColor; + float4 _BaseMap_ST; + float _BakedMutiplier = 1; + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + //https://coty.tips/raytracing-in-unity/ + [shader("closesthit")] + void MyClosestHit(inout RayPayload payload, + AttributeData attributes : SV_IntersectionAttributes) { + + payload.color = float4(0,0,0,1); //Intializing + payload.dir = float3(1,0,0); + + // #if _EMISSION_ON + uint2 launchIdx = DispatchRaysIndex(); + // ShadingData shade = getShadingData( PrimitiveIndex(), attribs ); + + uint primitiveIndex = PrimitiveIndex(); + uint3 triangleIndicies = UnityRayTracingFetchTriangleIndices(primitiveIndex); + Vertex v0, v1, v2; + + v0.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.x, kVertexAttributeTexCoord0); + v1.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.y, kVertexAttributeTexCoord0); + v2.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.z, kVertexAttributeTexCoord0); + + // v0.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.x, kVertexAttributeNormal); + // v1.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.y, kVertexAttributeNormal); + // v2.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.z, kVertexAttributeNormal); + + float3 barycentrics = float3(1.0 - attributes.barycentrics.x - attributes.barycentrics.y, attributes.barycentrics.x, attributes.barycentrics.y); + + Vertex vInterpolated; + vInterpolated.texcoord = v0.texcoord * barycentrics.x + v1.texcoord * barycentrics.y + v2.texcoord * barycentrics.z; + //TODO: Extract normal direction to ignore the backside of emissive objects + //vInterpolated.normal = v0.normal * barycentrics.x + v1.normal * barycentrics.y + v2.normal * barycentrics.z; + // if ( dot(vInterpolated.normal, float3(1,0,0) < 0) ) payload.color = float4(0,10,0,1) ; + // else payload.color = float4(10,0,0,1) ; + + //TODO: Figure out how to tie Amplify into using Texture2d and SamplerState instead of the bundled sampler2D. Forcing names for now. + //#if _ALBEDOMULTIPLY_ON + float4 albedo = float4(_BaseMap.SampleLevel(sampler_BaseMap, vInterpolated.texcoord.xy * _BaseMap_ST.xy + _BaseMap_ST.zw, 0 ).rgb , 1) ; + // #else + // float4 albedo = float4(1,1,1,1); + // #endif + + payload.color = float4( (_EmissionMap.SampleLevel(sampler_EmissionMap, vInterpolated.texcoord * _BaseMap_ST.xy + _BaseMap_ST.zw,0) ).rgb * _EmissionColor.rgb * albedo.rgb * _BakedMutiplier , 1 ); + // #else + // payload.color = float4(0,0,0,1); + + // #endif + } + ENDHLSL + + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend One Zero, One Zero + ColorMask RGBA + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_DEPTH_WRITE_ON + #define _DISABLE_LIGHTMAPS + #define _DISABLE_SSAO + #pragma multi_compile_instancing + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_2D + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_texcoord2 : TEXCOORD2; + float4 ase_texcoord3 : TEXCOORD3; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _EmissionColor; + float4 _HologramEdgeColor; + float _Noise; + float _ScanlineSize; + float _DepthFader; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g34( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID( v ); + UNITY_TRANSFER_INSTANCE_ID( v, o ); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord3 = screenPos; + + o.ase_texcoord2.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord2.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 texCoord26 = IN.ase_texcoord2.xy * float2( 1,1 ) + float2( 0,0 ); + float4 tex2DNode7 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, texCoord26 ); + float4 screenPos = IN.ase_texcoord3; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float2 screenUV27_g34 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g34 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g34 = GetScreenNoiseRGBASlice27_g34( screenUV27_g34 , offsetFrame27_g34 ); + float4 temp_output_198_0 = localGetScreenNoiseRGBASlice27_g34; + float4 temp_cast_0 = (0.5).xxxx; + float4 temp_output_78_0 = ( ( temp_output_198_0 - temp_cast_0 ) * _Noise ); + float4 temp_output_91_0 = ( tex2DNode7 + temp_output_78_0 ); + + + float3 Albedo = temp_output_91_0.rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + half4 color = half4( Albedo, Alpha ); + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + return color; + } + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormals" } + + ZWrite On + Blend One Zero + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_DEPTH_WRITE_ON + #define _DISABLE_LIGHTMAPS + #define _DISABLE_SSAO + #pragma multi_compile_instancing + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/Color.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + float4 ase_texcoord5 : TEXCOORD5; + float4 ase_texcoord6 : TEXCOORD6; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _EmissionColor; + float4 _HologramEdgeColor; + float _Noise; + float _ScanlineSize; + float _DepthFader; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BumpMap); + SAMPLER(sampler_BumpMap); + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + + inline float3 MyCustomExpression( half4 In0 ) + { + return UnpackNormal(In0);; + } + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g34( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord6 = screenPos; + + o.ase_texcoord4.xy = v.ase_texcoord.xy; + o.ase_texcoord5 = v.vertex; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal( v.ase_normal ); + float4 tangentWS = float4(TransformObjectToWorldDir( v.ase_tangent.xyz), v.ase_tangent.w); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + float3 WorldNormal = IN.worldNormal; + float4 WorldTangent = IN.worldTangent; + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 texCoord26 = IN.ase_texcoord4.xy * float2( 1,1 ) + float2( 0,0 ); + float4 In02_g33 = SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, texCoord26 ); + float3 localMyCustomExpression2_g33 = MyCustomExpression( In02_g33 ); + float3 temp_output_58_0 = localMyCustomExpression2_g33; + + float4 unityObjectToClipPos145 = TransformWorldToHClip(TransformObjectToWorld(IN.ase_texcoord5.xyz)); + float4 screenPos = IN.ase_texcoord6; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float2 screenUV27_g34 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g34 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g34 = GetScreenNoiseRGBASlice27_g34( screenUV27_g34 , offsetFrame27_g34 ); + float4 temp_output_198_0 = localGetScreenNoiseRGBASlice27_g34; + float temp_output_14_0 = ( unityObjectToClipPos145.w + ( (temp_output_198_0).w * _DepthFader ) ); + float4 tex2DNode7 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, texCoord26 ); + float lerpResult183 = lerp( ( ( (temp_output_198_0).w - 1.0 ) * 2.0 ) , 0.5 , ( _EmissionColor.a * tex2DNode7.a )); + + float3 Normal = temp_output_58_0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = ( ( ( 1.0 - ( temp_output_14_0 * _ZBufferParams.w ) ) / ( temp_output_14_0 * _ZBufferParams.z ) ) * ceil( lerpResult183 ) ); + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + return half4(packedNormalWS, 0.0); + #else + + #if defined(_NORMALMAP) + #if _NORMAL_DROPOFF_TS + float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz); + float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz)); + #elif _NORMAL_DROPOFF_OS + float3 normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + float3 normalWS = Normal; + #endif + #else + float3 normalWS = WorldNormal; + #endif + + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + #endif + } + ENDHLSL + } + + + Pass + { + + Name "GBuffer" + Tags { "LightMode"="None" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM +#define _NORMAL_DROPOFF_TS 1#pragma multi_compile_fog#define ASE_FOG 1#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED#define ASE_DEPTH_WRITE_ON#define _DISABLE_LIGHTMAPS#define _DISABLE_SSAO#pragma multi_compile_instancing#define _EMISSION#define _NORMALMAP 1#define ASE_SRP_VERSION 999999#define ASE_USING_SAMPLING_MACROS 1 +#if FALSE + #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_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 _ _MIXED_LIGHTING_SUBTRACTIVE + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _GBUFFER_NORMALS_OCT + //#pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile _ _RENDER_PASS_ENABLED + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_GBUFFER + + #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/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + #define ASE_NEEDS_FRAG_SCREEN_POSITION + #define ASE_NEEDS_FRAG_WORLD_TANGENT + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_BITANGENT + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + float4 ase_texcoord9 : TEXCOORD9; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _EmissionColor; + float4 _HologramEdgeColor; + float _Noise; + float _ScanlineSize; + float _DepthFader; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + TEXTURE2D(_BumpMap); + SAMPLER(sampler_BumpMap); + TEXTURE2D(_MetallicGlossMap); + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + inline float4 GetScreenNoiseRGBASlice27_g34( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + inline float3 MyCustomExpression( half4 In0 ) + { + return UnpackNormal(In0);; + } + + real3 ASESafeNormalize(float3 inVec) + { + real dp3 = max(FLT_MIN, dot(inVec, inVec)); + return inVec* rsqrt( dp3); + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xy = v.texcoord.xy; + o.ase_texcoord9 = v.vertex; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + FragmentOutput frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #else + ShadowCoords = float4(0, 0, 0, 0); + #endif + + + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 texCoord26 = IN.ase_texcoord8.xy * float2( 1,1 ) + float2( 0,0 ); + float4 tex2DNode7 = SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, texCoord26 ); + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( ScreenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float2 screenUV27_g34 = (ase_grabScreenPosNorm).xy; + float offsetFrame27_g34 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g34 = GetScreenNoiseRGBASlice27_g34( screenUV27_g34 , offsetFrame27_g34 ); + float4 temp_output_198_0 = localGetScreenNoiseRGBASlice27_g34; + float4 temp_cast_0 = (0.5).xxxx; + float4 temp_output_78_0 = ( ( temp_output_198_0 - temp_cast_0 ) * _Noise ); + float4 temp_output_91_0 = ( tex2DNode7 + temp_output_78_0 ); + + float4 In02_g33 = SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, texCoord26 ); + float3 localMyCustomExpression2_g33 = MyCustomExpression( In02_g33 ); + float3 temp_output_58_0 = localMyCustomExpression2_g33; + + float3 tanToWorld0 = float3( WorldTangent.x, WorldBiTangent.x, WorldNormal.x ); + float3 tanToWorld1 = float3( WorldTangent.y, WorldBiTangent.y, WorldNormal.y ); + float3 tanToWorld2 = float3( WorldTangent.z, WorldBiTangent.z, WorldNormal.z ); + float3 tanNormal56 = temp_output_58_0; + float3 worldNormal56 = float3(dot(tanToWorld0,tanNormal56), dot(tanToWorld1,tanNormal56), dot(tanToWorld2,tanNormal56)); + float3 normalizeResult85 = ASESafeNormalize( WorldViewDirection ); + float dotResult53 = dot( worldNormal56 , normalizeResult85 ); + float temp_output_54_0 = ( 1.0 - dotResult53 ); + float4 temp_output_87_0 = ( ( temp_output_54_0 * temp_output_54_0 * temp_output_54_0 ) * _HologramEdgeColor ); + float4 temp_cast_4 = (0.5).xxxx; + float temp_output_65_0 = ( ( ase_grabScreenPosNorm.g * ( _ScreenParams.y / _ScanlineSize ) ) % 2.0 ); + float4 temp_cast_6 = (0.5).xxxx; + + float4 tex2DNode86 = SAMPLE_TEXTURE2D( _MetallicGlossMap, sampler_BaseMap, texCoord26 ); + + float lerpResult96 = lerp( temp_output_65_0 , 1.0 , saturate( ( dotResult53 - 0.2 ) )); + + float4 unityObjectToClipPos145 = TransformWorldToHClip(TransformObjectToWorld(IN.ase_texcoord9.xyz)); + float temp_output_14_0 = ( unityObjectToClipPos145.w + ( (temp_output_198_0).w * _DepthFader ) ); + float lerpResult183 = lerp( ( ( (temp_output_198_0).w - 1.0 ) * 2.0 ) , 0.5 , ( _EmissionColor.a * tex2DNode7.a )); + + float3 Albedo = temp_output_91_0.rgb; + float3 Normal = temp_output_58_0; + float3 Emission = ( _EmissionColor * ( ( temp_output_87_0 * _HologramEdgeColor.a ) + ( ( temp_output_87_0 + temp_output_78_0 ) * temp_output_65_0 * temp_output_91_0 ) ) ).rgb; + float3 Specular = 0.5; + float Metallic = tex2DNode86.r; + float Smoothness = tex2DNode86.b; + float Occlusion = ( tex2DNode86.g * lerpResult96 ); + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = ( ( ( 1.0 - ( temp_output_14_0 * _ZBufferParams.w ) ) / ( temp_output_14_0 * _ZBufferParams.z ) ) * ceil( lerpResult183 ) ); + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = IN.clipPos; + inputData.shadowCoord = ShadowCoords; + + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + #else + inputData.normalWS = WorldNormal; + #endif + + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + inputData.viewDirectionWS = SafeNormalize( WorldViewDirection ); + + + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(WorldPosition, 1.0), IN.fogFactorAndVertexLight.x); + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.clipPos, + Albedo, + Specular, + inputData.normalWS, + Metallic, + Occlusion, + Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData + (Albedo, Metallic, Specular, Smoothness, Alpha, brdfData); + + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + half4 color; + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + color.a = Alpha; + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_DEPTH_WRITE_ON + #define _DISABLE_LIGHTMAPS + #define _DISABLE_SSAO + #pragma multi_compile_instancing + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _EmissionColor; + float4 _HologramEdgeColor; + float _Noise; + float _ScanlineSize; + float _DepthFader; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_DEPTH_WRITE_ON + #define _DISABLE_LIGHTMAPS + #define _DISABLE_SSAO + #pragma multi_compile_instancing + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _EmissionColor; + float4 _HologramEdgeColor; + float _Noise; + float _ScanlineSize; + float _DepthFader; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphLitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +556;179;1410;1119;1050.238;1092.71;2.396823;True;True +Node;AmplifyShaderEditor.CommentaryNode;163;-1992.93,-206.9442;Inherit;False;2042.17;519.2178;Edge coloring;8;87;88;89;54;55;48;166;167;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;167;-1982.529,-157.5087;Inherit;False;630.5564;386.2253;Fresnel;4;52;85;56;53;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;166;-514.7498,-52.95169;Inherit;False;430.2299;317.7492;Add noise and multiply with albedo;2;79;47;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;158;-1517.855,1012.331;Inherit;False;1801.283;486.7962;Dither in clipspace;12;14;146;15;24;12;145;18;17;13;16;111;157;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;164;-405.1964,322.276;Inherit;False;844.462;231.924;scanline to AO;4;93;96;100;99;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;165;-488.244,-513.2033;Inherit;False;202;185;add noise to albedo;1;91;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;160;-2682.31,574.5032;Inherit;False;862.9883;541.9784;Scanline effect;6;68;72;147;71;70;65;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;159;-1255.509,652.848;Inherit;False;745.0706;268.9492;Color noise;4;98;78;80;81;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;178;524.7984,516.2952;Inherit;False;805.9341;539.0737;Emission tinting and psdo-alpha;8;189;183;190;154;153;152;187;199;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;161;-2238.849,-1251.15;Inherit;False;853.8884;739.2095;Basemaps;5;25;26;7;86;58;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.UnityObjToClipPosHlpNode;145;-1250.941,1280.038;Inherit;False;1;0;FLOAT3;0,0,0;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;13;-429.0687,1283.933;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.CeilOpNode;189;1005.857,856.962;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;68;-2228.937,698.0006;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleRemainderNode;65;-2054.322,699.1375;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;154;1180.531,867.2163;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;187;532.295,792.4898;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.OneMinusNode;17;-454.8657,1103.681;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;24;-1117.33,1128.118;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WireNode;168;-1296,352;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.OneMinusNode;54;-1306.219,-41.01093;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;100;-355.1964,381.3237;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0.2;False;1;FLOAT;0 +Node;AmplifyShaderEditor.LerpOp;183;812.5939,788.0898;Inherit;False;3;0;FLOAT;1;False;1;FLOAT;0.5;False;2;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;98;-954.3539,805.7972;Inherit;False;Property;_Noise;Noise;5;0;Create;True;0;0;0;False;0;False;0.136;0.189;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;78;-672.4381,702.848;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0.1603774;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.PosVertexDataNode;146;-1467.855,1283.397;Inherit;False;0;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.ScreenParams;71;-2607.225,796.4866;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;80;-1011.571,714.59;Inherit;False;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;199;678.2019,929.3956;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;190;673.8575,791.6624;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ZBufferParams;15;-946.0206,1316.128;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;55;-1110.801,-133.0509;Inherit;True;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;12;-1405.141,1191.881;Inherit;False;Property;_DepthFader;Depth Fader;1;0;Create;True;0;0;0;False;0;False;0.15;0.12;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;48;-976.2174,79.47351;Inherit;False;Property;_HologramEdgeColor;Hologram Edge Color;3;1;[HDR];Create;True;0;0;0;False;0;False;0.2803489,0.5694646,0.9433962,0.09019608;1.247059,0.11,0.01568628,0.1215686;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RelayNode;157;133.4281,1109.07;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;14;-810.8926,1088.93;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SwizzleNode;177;-648.2431,935.3859;Inherit;False;FLOAT;3;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;16;-612.344,1099.455;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;47;-320.5199,10.79749;Inherit;True;3;3;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SamplerNode;7;-1902.078,-1201.15;Inherit;True;Property;_BaseMap;Base Map;0;0;Create;True;0;0;0;False;0;False;-1;None;6c9c24b6a17e8cd4c910d81887b68ee3;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;81;-1201.432,797.887;Inherit;False;Constant;_Float2;Float 2;5;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;86;-1896.889,-741.9405;Inherit;True;Property;_MetallicGlossMap;Metallic, AO, Smoothness;4;1;[NoScaleOffset];Create;False;0;0;0;False;0;False;7;None;8dd58822f420adc4ab213165112114cb;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.ColorNode;152;617.5811,584.4951;Inherit;False;Property;_EmissionColor;Emission tint;7;1;[HDR];Create;False;0;0;0;False;0;False;1,1,1,1;1,1,1,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SwizzleNode;111;-1380.493,1063.638;Inherit;False;FLOAT;3;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;18;-255.269,1104.374;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;88;-67.65933,-144.9931;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.GrabScreenPosition;72;-2632.31,624.5032;Inherit;False;0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.NormalizeNode;85;-1759.143,42.52801;Inherit;False;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;153;946.339,586.6653;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;87;-757.3683,-73.28355;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;93;277.2657,372.276;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FunctionNode;58;-1602.96,-937.243;Inherit;False;UnpackNormal;-1;;33;e881a95dc12b33643ac7d663807711b1;0;1;1;FLOAT4;0,0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;91;-438.244,-463.2033;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.ViewDirInputsCoordNode;52;-1934.612,28.5512;Inherit;False;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SaturateNode;99;-195.3589,375.4217;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FunctionNode;198;-1661.449,811.9089;Inherit;False;Global Blue Noise Sample;-1;;34;bac712bbbce65c14c9d4cbc808f3d0e0;0;2;8;FLOAT2;0,0;False;10;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;79;-464.7497,-2.95169;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.LerpOp;96;14.39998,395.2;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;1;False;2;FLOAT;0.5;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WireNode;162;164.3546,-460.9641;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WorldNormalVector;56;-1795.93,-107.5087;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.TextureCoordinatesNode;26;-2188.849,-1151.569;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.DotProductOpNode;53;-1586.973,-25.28336;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;89;-568.7856,-147.8442;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.RangedFloatNode;147;-2579.685,1000.482;Inherit;False;Property;_ScanlineSize;ScanlineSize;6;0;Create;True;0;0;0;False;0;False;1.5;1.5;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;70;-2371.177,768.7841;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;5;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;25;-1906.612,-973.0698;Inherit;True;Property;_BumpMap;Bump Map;2;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;25;None;390800c9a68bb6d4a8f6080fcedf2590;True;0;True;bump;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;109;896.9503,-56.88453;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;101;896.9503,-28.88453;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;103;896.9503,-56.88453;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;105;896.9503,-56.88453;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;104;896.9503,-56.88453;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;193;1141.95,41.11547;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=None;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;102;1141.95,-28.88453;Half;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;SLZ/Hologram Depth fade;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;23;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;True;0;False;-1;True;0;False;-1;True;False;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=100;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalForward;False;False;0;Hidden/InternalErrorShader;0;0;Standard;48;Workflow;1;0;Surface;0;0; Refraction Model;0;0; Blend;0;0;Two Sided;1;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Transmission;0;0; Transmission Shadow;0.5,False,-1;0;Translucency;0;0; Translucency Strength;1,False,-1;0; Normal Distortion;0.5,False,-1;0; Scattering;2,False,-1;0; Direct;0.9,False,-1;0; Ambient;0.1,False,-1;0; Shadow;0.5,False,-1;0;Cast Shadows;1;0; Use Shadow Threshold;0;0;Receive Shadows;1;0;GPU Instancing;1;637958567270329948;LOD CrossFade;0;637826276518736143;Built-in Fog;1;0;Lightmaps;0;637946548730332324;Volumetrics;1;0;Decals;0;0;Screen Space Occlusion;0;637952535710893479;Reflection Probe Blend/Projection;1;0;Light Layers;0;0;_FinalColorxAlpha;0;0;Meta Pass;0;637958566584180353;GBuffer Pass;0;0;Override Baked GI;0;0;Extra Pre Pass;0;0;DOTS Instancing;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Write Depth;1;637807274411999678; Early Z;0;637808158371656942;Vertex Position,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;0;637807264233463339;Fluorescence;0;0;0;10;False;True;True;True;False;True;True;True;True;True;False;;True;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;106;896.9503,-56.88453;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;110;896.9503,-56.88453;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;107;896.9503,-56.88453;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormals;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.CommentaryNode;169;-1711.449,761.9089;Inherit;False;320;185;Noise from global texture;0;;1,1,1,1;0;0 +WireConnection;145;0;146;0 +WireConnection;13;0;14;0 +WireConnection;13;1;15;3 +WireConnection;189;0;183;0 +WireConnection;68;0;72;2 +WireConnection;68;1;70;0 +WireConnection;65;0;68;0 +WireConnection;154;0;157;0 +WireConnection;154;1;189;0 +WireConnection;187;0;177;0 +WireConnection;17;0;16;0 +WireConnection;24;0;111;0 +WireConnection;24;1;12;0 +WireConnection;168;0;53;0 +WireConnection;54;0;53;0 +WireConnection;100;0;168;0 +WireConnection;183;0;190;0 +WireConnection;183;2;199;0 +WireConnection;78;0;80;0 +WireConnection;78;1;98;0 +WireConnection;80;0;198;0 +WireConnection;80;1;81;0 +WireConnection;199;0;152;4 +WireConnection;199;1;7;4 +WireConnection;190;0;187;0 +WireConnection;55;0;54;0 +WireConnection;55;1;54;0 +WireConnection;55;2;54;0 +WireConnection;157;0;18;0 +WireConnection;14;0;145;4 +WireConnection;14;1;24;0 +WireConnection;177;0;198;0 +WireConnection;16;0;14;0 +WireConnection;16;1;15;4 +WireConnection;47;0;79;0 +WireConnection;47;1;65;0 +WireConnection;47;2;91;0 +WireConnection;7;1;26;0 +WireConnection;86;1;26;0 +WireConnection;111;0;198;0 +WireConnection;18;0;17;0 +WireConnection;18;1;13;0 +WireConnection;88;0;89;0 +WireConnection;88;1;47;0 +WireConnection;85;0;52;0 +WireConnection;153;0;152;0 +WireConnection;153;1;88;0 +WireConnection;87;0;55;0 +WireConnection;87;1;48;0 +WireConnection;93;0;162;0 +WireConnection;93;1;96;0 +WireConnection;58;1;25;0 +WireConnection;91;0;7;0 +WireConnection;91;1;78;0 +WireConnection;99;0;100;0 +WireConnection;79;0;87;0 +WireConnection;79;1;78;0 +WireConnection;96;0;65;0 +WireConnection;96;2;99;0 +WireConnection;162;0;86;2 +WireConnection;56;0;58;0 +WireConnection;53;0;56;0 +WireConnection;53;1;85;0 +WireConnection;89;0;87;0 +WireConnection;89;1;48;4 +WireConnection;70;0;71;2 +WireConnection;70;1;147;0 +WireConnection;25;1;26;0 +WireConnection;102;0;91;0 +WireConnection;102;1;58;0 +WireConnection;102;2;153;0 +WireConnection;102;20;48;0 +WireConnection;102;3;86;1 +WireConnection;102;4;86;3 +WireConnection;102;5;93;0 +WireConnection;102;17;154;0 +ASEEND*/ +//CHKSM=FE78AAD06BFDD32A6EA9B17ADF3196523570F138 \ No newline at end of file diff --git a/Assets/SLZShaders/OpaqueHologram.shader.meta b/Assets/SLZShaders/OpaqueHologram.shader.meta new file mode 100644 index 0000000..6cbe9ba --- /dev/null +++ b/Assets/SLZShaders/OpaqueHologram.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: f71cd8ed99405284ab09d18bf11d03ab +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/ParallaxCubeMap.shader b/Assets/SLZShaders/ParallaxCubeMap.shader new file mode 100644 index 0000000..0e71d0b --- /dev/null +++ b/Assets/SLZShaders/ParallaxCubeMap.shader @@ -0,0 +1,3515 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/ParallaxCubeMap" +{ + Properties + { + [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [ASEBegin][Header(Main Surface Data)][Space(10)]_MainTex("MainTex", 2D) = "white" {} + _BaseColor("Surface Color", Color) = (1,1,1,0) + [Header(Main Surface Data)][Space(10)]_MAS("MAS", 2D) = "white" {} + [Normal]_BumpMap1("Surface Normal map", 2D) = "bump" {} + _NormalScale("NormalScale", Float) = 1 + [Header(Using Local space requires Static Batching to be disabled)][Space(5)][Toggle(_LOCALSPACE_ON)] _LocalSpace("Local Space", Float) = 0 + _WindowWorldPos("WindowWorldPos", Vector) = (0,0,0,0) + _Pos("Pos", Vector) = (0,0,0,0) + _Pos2("Pos2", Vector) = (0,0,0,0) + _Boxscale("Box scale", Vector) = (0,0,0,0) + _DistortionNormalScale("Distortion Normal Scale", Float) = 1 + [Normal]_BumpMap2("Distortion Normal map", 2D) = "bump" {} + _FresnelBlur("FresnelBlur", Range( 0 , 10)) = 0 + [HDR]_Color("Parallax Color Tint", Color) = (1,1,1,0) + _FresnelTint("Fresnel Tint", Color) = (0,0,0,0) + _MaxMip("Max Mip", Float) = 1 + _MinMip("MinMip", Float) = 0 + _CubeMap("CubeMap", CUBE) = "white" {} + _BakedMultiplier("Baked Multiplier", Float) = 1 + [ASEEnd]_WorldNormalBlend("WorldNormalBlend", Range( 0 , 1)) = 0 + [HideInInspector] _texcoord( "", 2D ) = "white" {} + + [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) = "" {} + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + + + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" } + Cull Back + ZWrite On + ZTest LEqual + Offset 0 , 0 + AlphaToMask Off + + HLSLINCLUDE + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForward" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_FORWARD + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.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.core/ShaderLibrary/TextureStack.hlsl" + + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_POSITION + #define ASE_NEEDS_FRAG_WORLD_TANGENT + #define ASE_NEEDS_FRAG_WORLD_BITANGENT + #pragma shader_feature_local _LOCALSPACE_ON + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.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.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _FresnelTint; + float4 _BumpMap2_ST; + float4 _WindowWorldPos; + float4 _BumpMap1_ST; + float4 _BaseColor; + float4 _MAS_ST; + float3 _Boxscale; + float3 _Pos; + float3 _Pos2; + float _BakedMultiplier; + float _NormalScale; + float _DistortionNormalScale; + float _FresnelBlur; + float _MinMip; + float _MaxMip; + float _WorldNormalBlend; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _MainTex; + sampler2D _BumpMap1; + samplerCUBE _CubeMap; + sampler2D _BumpMap2; + sampler2D _MAS; + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + #endif + + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) || defined(ASE_TERRAIN_INSTANCING) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 uv_MainTex = IN.ase_texcoord8.xy * _MainTex_ST.xy + _MainTex_ST.zw; + float4 tex2DNode11 = tex2D( _MainTex, uv_MainTex ); + float4 temp_output_120_0 = ( tex2DNode11 * _BaseColor ); + + float2 uv_BumpMap1 = IN.ase_texcoord8.xy * _BumpMap1_ST.xy + _BumpMap1_ST.zw; + float3 unpack77 = UnpackNormalScale( tex2D( _BumpMap1, uv_BumpMap1 ), _NormalScale ); + unpack77.z = lerp( 1, unpack77.z, saturate(_NormalScale) ); + + float3 lerpResult134 = lerp( -WorldViewDirection , WorldNormal , _WorldNormalBlend); + float3 temp_output_39_0 = saturate( ceil( lerpResult134 ) ); + float4 matrixToPos104 = float4( GetObjectToWorldMatrix()[0][3],GetObjectToWorldMatrix()[1][3],GetObjectToWorldMatrix()[2][3],GetObjectToWorldMatrix()[3][3]); + float3 temp_output_107_0 = (matrixToPos104).xyz; + float3 temp_output_108_0 = ( WorldPosition - temp_output_107_0 ); + #ifdef _LOCALSPACE_ON + float3 staticSwitch99 = temp_output_108_0; + #else + float3 staticSwitch99 = ( WorldPosition - (_WindowWorldPos).xyz ); + #endif + float3 break32 = ( (( ( ( ( _Boxscale + _Pos ) * temp_output_39_0 ) + ( ( -_Boxscale + _Pos2 ) * ( 1.0 - temp_output_39_0 ) ) ) - staticSwitch99 )).xyz / lerpResult134 ); + float2 uv_BumpMap2 = IN.ase_texcoord8.xy * _BumpMap2_ST.xy + _BumpMap2_ST.zw; + float3 unpack84 = UnpackNormalScale( tex2D( _BumpMap2, uv_BumpMap2 ), _DistortionNormalScale ); + unpack84.z = lerp( 1, unpack84.z, saturate(_DistortionNormalScale) ); + float3 tanToWorld0 = float3( WorldTangent.x, WorldBiTangent.x, WorldNormal.x ); + float3 tanToWorld1 = float3( WorldTangent.y, WorldBiTangent.y, WorldNormal.y ); + float3 tanToWorld2 = float3( WorldTangent.z, WorldBiTangent.z, WorldNormal.z ); + float3 ase_tanViewDir = tanToWorld0 * WorldViewDirection.x + tanToWorld1 * WorldViewDirection.y + tanToWorld2 * WorldViewDirection.z; + ase_tanViewDir = normalize(ase_tanViewDir); + float3 normalizeResult66 = normalize( ase_tanViewDir ); + float dotResult63 = dot( unpack84 , normalizeResult66 ); + float temp_output_133_0 = saturate( dotResult63 ); + float temp_output_65_0 = ( ( 1.0 - temp_output_133_0 ) * _FresnelBlur ); + float4 lerpResult117 = lerp( _FresnelTint , _Color , temp_output_133_0); + float4 lerpResult14 = lerp( float4( 0,0,0,0 ) , ( texCUBElod( _CubeMap, float4( ( ( lerpResult134 * min( min( break32.x , break32.y ) , break32.z ) ) + ( staticSwitch99 - _Pos ) ), (_MinMip + (temp_output_65_0 - 0.0) * (_MaxMip - _MinMip) / (1.0 - 0.0))) ) * lerpResult117 * temp_output_133_0 * ( 1.0 - (temp_output_120_0).a ) ) , tex2DNode11.a); + + float2 uv_MAS = IN.ase_texcoord8.xy * _MAS_ST.xy + _MAS_ST.zw; + float4 tex2DNode132 = tex2D( _MAS, uv_MAS ); + + float3 Albedo = temp_output_120_0.rgb; + float3 Normal = unpack77; + float3 Emission = lerpResult14.rgb; +#if 0 + float3 BakedEmission = ( texCUBElod( _CubeMap, float4( temp_output_108_0, 0.0) ) * _Color * _BakedMultiplier ).rgb; +#endif + float3 Specular = 0.5; + float Metallic = tex2DNode132.r; + float Smoothness = tex2DNode132.b; + float Occlusion = tex2DNode132.g; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _CLEARCOAT + float CoatMask = 0; + float CoatSmoothness = 0; + #endif + + #if defined(_FLUORESCENCE) + float4 Fluorescence = 0; + float4 Absorbance = 0; + #endif + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = ShadowCoords; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + + #ifdef ASE_FOG + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzww; //TODO: Shuffle things in vertex streams so we get full RGBA color rather than RGBB here + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xyz, IN.dynamicLightmapUV.xy, IN.vertexSH, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, IN.vertexSH , inputData.normalWS); + #endif + + #else + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + #endif + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = Albedo; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + #if defined(_FLUORESCENCE) + surfaceData.fluorescence = Fluorescence; + surfaceData.absorbance = Absorbance; + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData); + #endif + + half4 color = UniversalFragmentPBR( inputData, surfaceData); + + #ifdef LIGHTMAP_ON + float3 MetalSpec = lerp(kDieletricSpec.rgb, surfaceData.albedo , surfaceData.metallic); + color.rgb += BakedSpecular * surfaceData.occlusion * MetalSpec * inputData.bakedGI.rgb; + #endif + + #ifdef _TRANSMISSION_ASE + { + float shadow = _TransmissionShadow; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; + color.rgb += Albedo * mainTransmission; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; + color.rgb += Albedo * transmission; + } + #endif + } + #endif + + #ifdef _TRANSLUCENCY_ASE + { + float shadow = _TransShadow; + float normal = _TransNormal; + float scattering = _TransScattering; + float direct = _TransDirect; + float ambient = _TransAmbient; + float strength = _TransStrength; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + + half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; + half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); + half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * mainTranslucency * strength; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 lightDir = light.direction + inputData.normalWS * normal; + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * translucency * strength; + } + #endif + } + #endif + + #ifdef _REFRACTION_ASE + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, IN.fogFactorAndVertexLight.x); + #endif + #endif + + color = Volumetrics( color, inputData.positionWS); + + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return color; + } + + ENDHLSL + } + + + Pass + { + + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _FresnelTint; + float4 _BumpMap2_ST; + float4 _WindowWorldPos; + float4 _BumpMap1_ST; + float4 _BaseColor; + float4 _MAS_ST; + float3 _Boxscale; + float3 _Pos; + float3 _Pos2; + float _BakedMultiplier; + float _NormalScale; + float _DistortionNormalScale; + float _FresnelBlur; + float _MinMip; + float _MaxMip; + float _WorldNormalBlend; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + float3 _LightDirection; + float3 _LightPosition; + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + float3 normalWS = TransformObjectToWorldDir(v.ase_normal); + + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + float2 vShadowOffsets = GetShadowOffsets( normalWS, lightDirectionWS ); + positionWS.xyz -= vShadowOffsets.y * lightDirectionWS.xyz * .01; + float4 clipPos = TransformObjectToHClip( float4( mul( unity_WorldToObject, float4( positionWS.xyz, 1.0 ) ).xyz, 1.0 ) ); + //float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + #if UNITY_REVERSED_Z + clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #else + clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #endif + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = clipPos; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + return 0; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _FresnelTint; + float4 _BumpMap2_ST; + float4 _WindowWorldPos; + float4 _BumpMap1_ST; + float4 _BaseColor; + float4 _MAS_ST; + float3 _Boxscale; + float3 _Pos; + float3 _Pos2; + float _BakedMultiplier; + float _NormalScale; + float _DistortionNormalScale; + float _FresnelBlur; + float _MinMip; + float _MaxMip; + float _WorldNormalBlend; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + + Pass + { + + Name "Meta" + Tags { "LightMode"="Meta" } + + Cull Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature _ EDITOR_VISUALIZATION + + #define SHADERPASS SHADERPASS_META + + #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/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #define ASE_NEEDS_FRAG_WORLD_POSITION + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef EDITOR_VISUALIZATION + float4 VizUV : TEXCOORD2; + float4 LightCoord : TEXCOORD3; + #endif + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _FresnelTint; + float4 _BumpMap2_ST; + float4 _WindowWorldPos; + float4 _BumpMap1_ST; + float4 _BaseColor; + float4 _MAS_ST; + float3 _Boxscale; + float3 _Pos; + float3 _Pos2; + float _BakedMultiplier; + float _NormalScale; + float _DistortionNormalScale; + float _FresnelBlur; + float _MinMip; + float _MaxMip; + float _WorldNormalBlend; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _MainTex; + samplerCUBE _CubeMap; + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord4.xy = v.texcoord0.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.clipPos = MetaVertexPosition( v.vertex, v.texcoord1.xy, v.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); + + #ifdef EDITOR_VISUALIZATION + float2 VizUV = 0; + float4 LightCoord = 0; + UnityEditorVizData(v.vertex.xyz, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, VizUV, LightCoord); + o.VizUV = float4(VizUV, 0, 0); + o.LightCoord = LightCoord; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = o.clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 uv_MainTex = IN.ase_texcoord4.xy * _MainTex_ST.xy + _MainTex_ST.zw; + float4 tex2DNode11 = tex2D( _MainTex, uv_MainTex ); + float4 temp_output_120_0 = ( tex2DNode11 * _BaseColor ); + + float4 matrixToPos104 = float4( GetObjectToWorldMatrix()[0][3],GetObjectToWorldMatrix()[1][3],GetObjectToWorldMatrix()[2][3],GetObjectToWorldMatrix()[3][3]); + float3 temp_output_107_0 = (matrixToPos104).xyz; + float3 temp_output_108_0 = ( WorldPosition - temp_output_107_0 ); + + + float3 Albedo = temp_output_120_0.rgb; + float3 Emission = ( texCUBElod( _CubeMap, float4( temp_output_108_0, 0.0) ) * _Color * _BakedMultiplier ).rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = Albedo; + metaInput.Emission = Emission; + #ifdef EDITOR_VISUALIZATION + metaInput.VizUV = IN.VizUV.xy; + metaInput.LightCoord = IN.LightCoord; + #endif + + return MetaFragment(metaInput); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "BakedRaytrace" + Tags{ "LightMode" = "BakedRaytrace" } + HLSLPROGRAM + + /*ase_pragma_before*/ + + #define SHADERPASS SHADERPASS_RAYTRACE + + #include "UnityRaytracingMeshUtils.cginc" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #define _EMISSION + #pragma raytracing test + #pragma shader_feature_local __ _ALBEDOMULTIPLY_ON + #pragma shader_feature_local __ _EMISSION_ON + + /*ase_pragma*/ + + struct RayPayload + { + float4 color; + float3 dir; + }; + + struct AttributeData + { + float2 barycentrics; + }; + + struct Vertex + { + float2 texcoord; + float3 normal; + }; + + Texture2D _BaseMap; + SamplerState sampler_BaseMap; + + CBUFFER_START( UnityPerMaterial ) + /*ase_srp_batcher*/ + Texture2D _EmissionMap; + SamplerState sampler_EmissionMap; + + float4 _EmissionColor; + float4 _BaseMap_ST; + float _BakedMutiplier = 1; + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + //https://coty.tips/raytracing-in-unity/ + [shader("closesthit")] + void MyClosestHit(inout RayPayload payload, + AttributeData attributes : SV_IntersectionAttributes) { + + payload.color = float4(0,0,0,1); //Intializing + payload.dir = float3(1,0,0); + + // #if _EMISSION_ON + uint2 launchIdx = DispatchRaysIndex(); + // ShadingData shade = getShadingData( PrimitiveIndex(), attribs ); + + uint primitiveIndex = PrimitiveIndex(); + uint3 triangleIndicies = UnityRayTracingFetchTriangleIndices(primitiveIndex); + Vertex v0, v1, v2; + + v0.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.x, kVertexAttributeTexCoord0); + v1.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.y, kVertexAttributeTexCoord0); + v2.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.z, kVertexAttributeTexCoord0); + + // v0.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.x, kVertexAttributeNormal); + // v1.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.y, kVertexAttributeNormal); + // v2.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.z, kVertexAttributeNormal); + + float3 barycentrics = float3(1.0 - attributes.barycentrics.x - attributes.barycentrics.y, attributes.barycentrics.x, attributes.barycentrics.y); + + Vertex vInterpolated; + vInterpolated.texcoord = v0.texcoord * barycentrics.x + v1.texcoord * barycentrics.y + v2.texcoord * barycentrics.z; + //TODO: Extract normal direction to ignore the backside of emissive objects + //vInterpolated.normal = v0.normal * barycentrics.x + v1.normal * barycentrics.y + v2.normal * barycentrics.z; + // if ( dot(vInterpolated.normal, float3(1,0,0) < 0) ) payload.color = float4(0,10,0,1) ; + // else payload.color = float4(10,0,0,1) ; + + //TODO: Figure out how to tie Amplify into using Texture2d and SamplerState instead of the bundled sampler2D. Forcing names for now. + //#if _ALBEDOMULTIPLY_ON + float4 albedo = float4(_BaseMap.SampleLevel(sampler_BaseMap, vInterpolated.texcoord.xy * _BaseMap_ST.xy + _BaseMap_ST.zw, 0 ).rgb , 1) ; + // #else + // float4 albedo = float4(1,1,1,1); + // #endif + + payload.color = float4( (_EmissionMap.SampleLevel(sampler_EmissionMap, vInterpolated.texcoord * _BaseMap_ST.xy + _BaseMap_ST.zw,0) ).rgb * _EmissionColor.rgb * albedo.rgb * _BakedMutiplier , 1 ); + // #else + // payload.color = float4(0,0,0,1); + + // #endif + } + ENDHLSL + + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend One Zero, One Zero + ColorMask RGBA + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_2D + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_texcoord2 : TEXCOORD2; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _FresnelTint; + float4 _BumpMap2_ST; + float4 _WindowWorldPos; + float4 _BumpMap1_ST; + float4 _BaseColor; + float4 _MAS_ST; + float3 _Boxscale; + float3 _Pos; + float3 _Pos2; + float _BakedMultiplier; + float _NormalScale; + float _DistortionNormalScale; + float _FresnelBlur; + float _MinMip; + float _MaxMip; + float _WorldNormalBlend; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _MainTex; + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID( v ); + UNITY_TRANSFER_INSTANCE_ID( v, o ); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + o.ase_texcoord2.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord2.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 uv_MainTex = IN.ase_texcoord2.xy * _MainTex_ST.xy + _MainTex_ST.zw; + float4 tex2DNode11 = tex2D( _MainTex, uv_MainTex ); + float4 temp_output_120_0 = ( tex2DNode11 * _BaseColor ); + + + float3 Albedo = temp_output_120_0.rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + half4 color = half4( Albedo, Alpha ); + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + return color; + } + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormals" } + + ZWrite On + Blend One Zero + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/Color.hlsl" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _FresnelTint; + float4 _BumpMap2_ST; + float4 _WindowWorldPos; + float4 _BumpMap1_ST; + float4 _BaseColor; + float4 _MAS_ST; + float3 _Boxscale; + float3 _Pos; + float3 _Pos2; + float _BakedMultiplier; + float _NormalScale; + float _DistortionNormalScale; + float _FresnelBlur; + float _MinMip; + float _MaxMip; + float _WorldNormalBlend; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _BumpMap1; + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord4.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal( v.ase_normal ); + float4 tangentWS = float4(TransformObjectToWorldDir( v.ase_tangent.xyz), v.ase_tangent.w); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + float3 WorldNormal = IN.worldNormal; + float4 WorldTangent = IN.worldTangent; + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 uv_BumpMap1 = IN.ase_texcoord4.xy * _BumpMap1_ST.xy + _BumpMap1_ST.zw; + float3 unpack77 = UnpackNormalScale( tex2D( _BumpMap1, uv_BumpMap1 ), _NormalScale ); + unpack77.z = lerp( 1, unpack77.z, saturate(_NormalScale) ); + + float3 Normal = unpack77; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + return half4(packedNormalWS, 0.0); + #else + + #if defined(_NORMALMAP) + #if _NORMAL_DROPOFF_TS + float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz); + float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz)); + #elif _NORMAL_DROPOFF_OS + float3 normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + float3 normalWS = Normal; + #endif + #else + float3 normalWS = WorldNormal; + #endif + + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + #endif + } + ENDHLSL + } + + + Pass + { + + Name "GBuffer" + Tags { "LightMode"="UniversalGBuffer" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM +#define _NORMAL_DROPOFF_TS 1#pragma multi_compile_fog#define ASE_FOG 1#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3#pragma multi_compile_fragment _ _LIGHT_LAYERS#define _EMISSION#define _NORMALMAP 1#define ASE_SRP_VERSION 999999 +#if FALSE + #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_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 _ _MIXED_LIGHTING_SUBTRACTIVE + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _GBUFFER_NORMALS_OCT + //#pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile _ _RENDER_PASS_ENABLED + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_GBUFFER + + #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/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_POSITION + #define ASE_NEEDS_FRAG_WORLD_TANGENT + #define ASE_NEEDS_FRAG_WORLD_BITANGENT + #pragma shader_feature_local _LOCALSPACE_ON + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _FresnelTint; + float4 _BumpMap2_ST; + float4 _WindowWorldPos; + float4 _BumpMap1_ST; + float4 _BaseColor; + float4 _MAS_ST; + float3 _Boxscale; + float3 _Pos; + float3 _Pos2; + float _BakedMultiplier; + float _NormalScale; + float _DistortionNormalScale; + float _FresnelBlur; + float _MinMip; + float _MaxMip; + float _WorldNormalBlend; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _MainTex; + sampler2D _BumpMap1; + samplerCUBE _CubeMap; + sampler2D _BumpMap2; + sampler2D _MAS; + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + FragmentOutput frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #else + ShadowCoords = float4(0, 0, 0, 0); + #endif + + + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 uv_MainTex = IN.ase_texcoord8.xy * _MainTex_ST.xy + _MainTex_ST.zw; + float4 tex2DNode11 = tex2D( _MainTex, uv_MainTex ); + float4 temp_output_120_0 = ( tex2DNode11 * _BaseColor ); + + float2 uv_BumpMap1 = IN.ase_texcoord8.xy * _BumpMap1_ST.xy + _BumpMap1_ST.zw; + float3 unpack77 = UnpackNormalScale( tex2D( _BumpMap1, uv_BumpMap1 ), _NormalScale ); + unpack77.z = lerp( 1, unpack77.z, saturate(_NormalScale) ); + + float3 lerpResult134 = lerp( -WorldViewDirection , WorldNormal , _WorldNormalBlend); + float3 temp_output_39_0 = saturate( ceil( lerpResult134 ) ); + float4 matrixToPos104 = float4( GetObjectToWorldMatrix()[0][3],GetObjectToWorldMatrix()[1][3],GetObjectToWorldMatrix()[2][3],GetObjectToWorldMatrix()[3][3]); + float3 temp_output_107_0 = (matrixToPos104).xyz; + float3 temp_output_108_0 = ( WorldPosition - temp_output_107_0 ); + #ifdef _LOCALSPACE_ON + float3 staticSwitch99 = temp_output_108_0; + #else + float3 staticSwitch99 = ( WorldPosition - (_WindowWorldPos).xyz ); + #endif + float3 break32 = ( (( ( ( ( _Boxscale + _Pos ) * temp_output_39_0 ) + ( ( -_Boxscale + _Pos2 ) * ( 1.0 - temp_output_39_0 ) ) ) - staticSwitch99 )).xyz / lerpResult134 ); + float2 uv_BumpMap2 = IN.ase_texcoord8.xy * _BumpMap2_ST.xy + _BumpMap2_ST.zw; + float3 unpack84 = UnpackNormalScale( tex2D( _BumpMap2, uv_BumpMap2 ), _DistortionNormalScale ); + unpack84.z = lerp( 1, unpack84.z, saturate(_DistortionNormalScale) ); + float3 tanToWorld0 = float3( WorldTangent.x, WorldBiTangent.x, WorldNormal.x ); + float3 tanToWorld1 = float3( WorldTangent.y, WorldBiTangent.y, WorldNormal.y ); + float3 tanToWorld2 = float3( WorldTangent.z, WorldBiTangent.z, WorldNormal.z ); + float3 ase_tanViewDir = tanToWorld0 * WorldViewDirection.x + tanToWorld1 * WorldViewDirection.y + tanToWorld2 * WorldViewDirection.z; + ase_tanViewDir = normalize(ase_tanViewDir); + float3 normalizeResult66 = normalize( ase_tanViewDir ); + float dotResult63 = dot( unpack84 , normalizeResult66 ); + float temp_output_133_0 = saturate( dotResult63 ); + float temp_output_65_0 = ( ( 1.0 - temp_output_133_0 ) * _FresnelBlur ); + float4 lerpResult117 = lerp( _FresnelTint , _Color , temp_output_133_0); + float4 lerpResult14 = lerp( float4( 0,0,0,0 ) , ( texCUBElod( _CubeMap, float4( ( ( lerpResult134 * min( min( break32.x , break32.y ) , break32.z ) ) + ( staticSwitch99 - _Pos ) ), (_MinMip + (temp_output_65_0 - 0.0) * (_MaxMip - _MinMip) / (1.0 - 0.0))) ) * lerpResult117 * temp_output_133_0 * ( 1.0 - (temp_output_120_0).a ) ) , tex2DNode11.a); + + float2 uv_MAS = IN.ase_texcoord8.xy * _MAS_ST.xy + _MAS_ST.zw; + float4 tex2DNode132 = tex2D( _MAS, uv_MAS ); + + float3 Albedo = temp_output_120_0.rgb; + float3 Normal = unpack77; + float3 Emission = lerpResult14.rgb; + float3 Specular = 0.5; + float Metallic = tex2DNode132.r; + float Smoothness = tex2DNode132.b; + float Occlusion = tex2DNode132.g; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = IN.clipPos; + inputData.shadowCoord = ShadowCoords; + + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + #else + inputData.normalWS = WorldNormal; + #endif + + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + inputData.viewDirectionWS = SafeNormalize( WorldViewDirection ); + + + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(WorldPosition, 1.0), IN.fogFactorAndVertexLight.x); + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.clipPos, + Albedo, + Specular, + inputData.normalWS, + Metallic, + Occlusion, + Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData + (Albedo, Metallic, Specular, Smoothness, Alpha, brdfData); + + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + half4 color; + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + color.a = Alpha; + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _FresnelTint; + float4 _BumpMap2_ST; + float4 _WindowWorldPos; + float4 _BumpMap1_ST; + float4 _BaseColor; + float4 _MAS_ST; + float3 _Boxscale; + float3 _Pos; + float3 _Pos2; + float _BakedMultiplier; + float _NormalScale; + float _DistortionNormalScale; + float _FresnelBlur; + float _MinMip; + float _MaxMip; + float _WorldNormalBlend; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #define _EMISSION + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _FresnelTint; + float4 _BumpMap2_ST; + float4 _WindowWorldPos; + float4 _BumpMap1_ST; + float4 _BaseColor; + float4 _MAS_ST; + float3 _Boxscale; + float3 _Pos; + float3 _Pos2; + float _BakedMultiplier; + float _NormalScale; + float _DistortionNormalScale; + float _FresnelBlur; + float _MinMip; + float _MaxMip; + float _WorldNormalBlend; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphLitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +2615;112;1538;1067;5379.674;878.0857;1.071727;True;True +Node;AmplifyShaderEditor.CommentaryNode;25;-4008.162,-205.8339;Inherit;False;609.7188;476.146;Skiping if statement for android;6;54;49;47;41;40;39;If;0.9811321,0.02313991,0.02313991,1;0;0 +Node;AmplifyShaderEditor.TFHCRemapNode;111;-1308.118,-148.489;Inherit;False;5;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;3;FLOAT;0;False;4;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;126;-944.5485,650.0201;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;65;-1284.169,-479.959;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;8;False;1;FLOAT;0 +Node;AmplifyShaderEditor.StaticSwitch;100;-4880.604,-260.9592;Inherit;False;Property;_LocalSpace;LocalSpace;15;0;Create;True;0;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Reference;99;True;True;All;9;1;FLOAT3;0,0,0;False;0;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT3;0,0,0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SamplerNode;11;-2109.955,-1085.791;Inherit;True;Property;_MainTex;MainTex;0;1;[Header];Create;True;1;Main Surface Data;0;0;False;1;Space(10);False;11;None;4778e747c31fdd141b66c930e50cbd97;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.ColorNode;119;-1193.971,248.5731;Inherit;False;Property;_FresnelTint;Fresnel Tint;16;0;Create;True;0;0;0;False;0;False;0,0,0,0;0.02894512,0.2547169,0,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RelayNode;36;-4214.263,-438.034;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.NegateNode;59;-5399.121,-308.1193;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SamplerNode;77;-2109.682,-901.4337;Inherit;True;Property;_BumpMap1;Surface Normal map;3;1;[Normal];Create;False;0;0;0;False;0;False;11;None;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.WireNode;37;-4344.163,338.1658;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;53;-2456.162,-93.83391;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.WireNode;51;-2584.162,402.1658;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SamplerNode;123;-820.9841,810.334;Inherit;True;Property;_TextureSample1;Texture Sample 1;1;0;Create;True;0;0;0;False;0;False;-1;None;46d5874372228443fa0640e1bebd08aa;True;0;False;black;LockedToCube;False;Object;-1;MipLevel;Cube;8;0;SAMPLERCUBE;;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;112;-1496.118,-6.488953;Inherit;False;Property;_MaxMip;Max Mip;17;0;Create;True;0;0;0;False;0;False;1;2;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;109;-2627.937,-681.7631;Float;False;Property;_DistortionNormalScale;Distortion Normal Scale;12;0;Create;True;0;0;0;False;0;False;1;2;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SwizzleNode;107;-5302.21,-727.2861;Inherit;False;FLOAT3;0;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.RelayNode;58;-4464.938,-357.7081;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SaturateNode;39;-3784.162,-157.8339;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.RangedFloatNode;129;-674.0391,1016.115;Inherit;False;Property;_BakedMultiplier;Baked Multiplier;20;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;84;-2322.722,-714.6106;Inherit;True;Property;_BumpMap2;Distortion Normal map;13;1;[Normal];Create;False;0;0;0;False;0;False;-1;None;a6bec17ddbb49455b97ab9d95650ffc2;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.ViewDirInputsCoordNode;62;-2594.897,-525.7339;Float;False;Tangent;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;125;-408.0619,842.7873;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SamplerNode;69;-1064.446,-248.8728;Inherit;True;Property;_CubeMapS;CubeMapS;7;2;[Header];[NoScaleOffset];Create;True;1;Parallax Options;0;0;False;1;Space(10);False;-1;None;ae25e28c233c45048b0e68d386a7dea2;True;0;False;black;LockedToCube;False;Object;-1;MipLevel;Cube;8;0;SAMPLERCUBE;;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.OneMinusNode;115;-867.7971,-853.4991;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;136;-5788.363,280.2531;Inherit;False;Property;_WorldNormalBlend;WorldNormalBlend;21;0;Create;True;0;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.CeilOpNode;40;-3960.162,-157.8339;Inherit;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;48;-1961.97,-314.1174;Inherit;True;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.ColorNode;73;-1169.222,37.35608;Inherit;False;Property;_Color;Parallax Color Tint;15;1;[HDR];Create;False;0;0;0;False;0;False;1,1,1,0;12.05757,31.12157,25.41867,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SaturateNode;133;-1674.247,-489.763;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.Vector3Node;43;-4552.163,-93.83391;Float;False;Property;_Pos;Pos;9;0;Create;True;0;0;0;False;0;False;0,0,0;-0.52,41.8,-32.84;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SimpleMinOpNode;56;-2319.395,-250.1176;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.DotProductOpNode;63;-1950.748,-558.8289;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.NormalizeNode;66;-2266.636,-504.8201;Inherit;False;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.RangedFloatNode;68;-1631.478,-403.3352;Float;False;Property;_FresnelBlur;FresnelBlur;14;0;Create;True;0;0;0;False;0;False;0;10;0;10;0;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;87;-1046.167,-469.3177;Inherit;False;Property;_BaseColor;Surface Color;1;0;Create;False;0;0;0;False;0;False;1,1,1,0;0.2924528,0.2924528,0.2924528,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;34;-3268,-160.9769;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;72;-589.4422,-78.17037;Inherit;True;4;4;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.Vector3Node;38;-4552.163,-253.8339;Float;False;Property;_Boxscale;Box scale;11;0;Create;True;0;0;0;False;0;False;0,0,0;18,18.8,50.6;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SimpleDivideOpNode;52;-2837.262,-157.3608;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.NegateNode;44;-4392.163,-173.8339;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.RangedFloatNode;86;-288.142,142.8333;Inherit;False;Property;_Metalic;Metalic;6;0;Create;True;0;0;0;False;0;False;0;0.971;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.OneMinusNode;67;-1479.745,-517.8773;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WorldNormalVector;138;-5809.057,117.0624;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;108;-5081.484,-504.2385;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.Vector3Node;57;-4536.163,66.1661;Float;False;Property;_Pos2;Pos2;10;0;Create;True;0;0;0;False;0;False;0,0,0;0,51.53,2.5;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.RangedFloatNode;64;-2304.001,-808.2642;Float;False;Property;_NormalScale;NormalScale;4;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMinOpNode;46;-2489.254,-258.6125;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ObjectToWorldMatrixNode;106;-5761.084,-747.0352;Inherit;False;0;1;FLOAT4x4;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;54;-3560.162,-13.83394;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.RangedFloatNode;113;-1506.118,-85.48895;Inherit;False;Property;_MinMip;MinMip;18;0;Create;True;0;0;0;False;0;False;0;0.5;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;85;-297.142,231.8333;Inherit;False;Property;_Smoothness;Smoothness;5;0;Create;True;0;0;0;False;0;False;0;0.864;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.PosFromTransformMatrix;104;-5536.874,-755.1671;Inherit;False;1;0;FLOAT4x4;1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.StaticSwitch;99;-4859.743,-641.0718;Inherit;False;Property;_LocalSpace;Local Space;7;0;Create;True;0;0;0;False;2;Header(Using Local space requires Static Batching to be disabled);Space(5);False;0;0;0;True;;Toggle;2;Key0;Key1;Create;True;True;All;9;1;FLOAT3;0,0,0;False;0;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT3;0,0,0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.Vector4Node;70;-5516.064,-979.4739;Inherit;False;Property;_WindowWorldPos;WindowWorldPos;8;0;Create;True;0;0;0;False;0;False;0,0,0,0;-9,43,-7.02,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.LerpOp;117;-873.733,17.19793;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;47;-3736.162,50.1661;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;45;-4184.162,-13.83394;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;55;-2188.324,-367.0969;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SamplerNode;132;-523.8444,357.0862;Inherit;True;Property;_MAS;MAS;2;1;[Header];Create;True;1;Main Surface Data;0;0;False;1;Space(10);False;11;None;68f1fe8d8a71b9a43a6cd8f2a07ef659;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.OneMinusNode;122;-251.5297,-172.7151;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WorldPosInputsNode;124;-1271.651,764.764;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.ViewDirInputsCoordNode;60;-5720.911,-310.0454;Float;True;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;120;-645.7218,-505.9521;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.RelayNode;26;-4572.299,-545.4812;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SwizzleNode;28;-5278.598,-945.2879;Inherit;False;FLOAT3;0;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.WorldPosInputsNode;29;-5525.235,-539.9832;Float;True;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;49;-3736.162,-61.83394;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.TexturePropertyNode;127;-1495.626,202.5853;Inherit;True;Property;_CubeMap;CubeMap;19;0;Create;True;0;0;0;False;0;False;None;a7681cfa7ba831944ba3d8ee4f311070;False;white;LockedToCube;Cube;-1;0;2;SAMPLERCUBE;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;31;-5088.497,-635.1635;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SwizzleNode;121;-402.9691,-202.5441;Inherit;False;FLOAT;3;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WireNode;50;-3224.162,514.1657;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.LerpOp;14;-235.3916,-56.47568;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.BreakToComponentsNode;32;-2620.222,-229.9563;Inherit;False;FLOAT3;1;0;FLOAT3;0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 +Node;AmplifyShaderEditor.OneMinusNode;41;-3960.162,66.1661;Inherit;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SwizzleNode;33;-3042.936,-123.68;Inherit;False;FLOAT3;0;1;2;3;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;42;-4200.162,-221.8339;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;131;-876.6942,587.5298;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.LerpOp;134;-5422.344,86.40601;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;93;136.5,-113.1;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;98;136.5,-113.1;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;97;136.5,-113.1;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;91;136.5,-113.1;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;95;136.5,-113.1;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormals;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;94;136.5,-113.1;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;90;218.1329,-123.2974;Half;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;SLZ/ParallaxCubeMap;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;23;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalForward;False;False;0;Hidden/InternalErrorShader;0;0;Standard;48;Workflow;1;0;Surface;0;0; Refraction Model;0;0; Blend;0;0;Two Sided;1;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Transmission;0;0; Transmission Shadow;0.5,False,-1;0;Translucency;0;0; Translucency Strength;1,False,-1;0; Normal Distortion;0.5,False,-1;0; Scattering;2,False,-1;0; Direct;0.9,False,-1;0; Ambient;0.1,False,-1;0; Shadow;0.5,False,-1;0;Cast Shadows;1;0; Use Shadow Threshold;0;0;Receive Shadows;1;0;GPU Instancing;0;637810008526190890;LOD CrossFade;0;637810008511809681;Built-in Fog;1;0;Lightmaps;1;0;Volumetrics;1;0;Decals;1;0;Screen Space Occlusion;1;0;Reflection Probe Blend/Projection;1;0;Light Layers;1;0;_FinalColorxAlpha;0;0;Meta Pass;1;0;GBuffer Pass;0;0;Override Baked GI;0;0;Extra Pre Pass;0;0;DOTS Instancing;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Write Depth;0;0; Early Z;0;0;Vertex Position,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;0;0;Fluorescence;0;0;0;10;False;True;True;True;True;True;True;True;True;True;False;;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;96;136.5,-113.1;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;89;136.5,-100.1;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;92;136.5,-113.1;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +WireConnection;111;0;65;0 +WireConnection;111;3;113;0 +WireConnection;111;4;112;0 +WireConnection;126;0;124;0 +WireConnection;126;1;107;0 +WireConnection;65;0;67;0 +WireConnection;65;1;68;0 +WireConnection;100;1;59;0 +WireConnection;36;0;58;0 +WireConnection;59;0;60;0 +WireConnection;77;5;64;0 +WireConnection;37;0;43;0 +WireConnection;53;0;26;0 +WireConnection;53;1;51;0 +WireConnection;51;0;50;0 +WireConnection;123;0;127;0 +WireConnection;123;1;108;0 +WireConnection;107;0;104;0 +WireConnection;58;0;134;0 +WireConnection;39;0;40;0 +WireConnection;84;5;109;0 +WireConnection;125;0;123;0 +WireConnection;125;1;73;0 +WireConnection;125;2;129;0 +WireConnection;69;0;127;0 +WireConnection;69;1;48;0 +WireConnection;69;2;111;0 +WireConnection;115;0;65;0 +WireConnection;40;0;36;0 +WireConnection;48;0;55;0 +WireConnection;48;1;53;0 +WireConnection;133;0;63;0 +WireConnection;56;0;46;0 +WireConnection;56;1;32;2 +WireConnection;63;0;84;0 +WireConnection;63;1;66;0 +WireConnection;66;0;62;0 +WireConnection;34;0;54;0 +WireConnection;34;1;26;0 +WireConnection;72;0;69;0 +WireConnection;72;1;117;0 +WireConnection;72;2;133;0 +WireConnection;72;3;122;0 +WireConnection;52;0;33;0 +WireConnection;52;1;58;0 +WireConnection;44;0;38;0 +WireConnection;67;0;133;0 +WireConnection;108;0;29;0 +WireConnection;108;1;107;0 +WireConnection;46;0;32;0 +WireConnection;46;1;32;1 +WireConnection;54;0;49;0 +WireConnection;54;1;47;0 +WireConnection;104;0;106;0 +WireConnection;99;1;31;0 +WireConnection;99;0;108;0 +WireConnection;117;0;119;0 +WireConnection;117;1;73;0 +WireConnection;117;2;133;0 +WireConnection;47;0;45;0 +WireConnection;47;1;41;0 +WireConnection;45;0;44;0 +WireConnection;45;1;57;0 +WireConnection;55;0;58;0 +WireConnection;55;1;56;0 +WireConnection;122;0;121;0 +WireConnection;120;0;11;0 +WireConnection;120;1;87;0 +WireConnection;26;0;99;0 +WireConnection;28;0;70;0 +WireConnection;49;0;42;0 +WireConnection;49;1;39;0 +WireConnection;31;0;29;0 +WireConnection;31;1;28;0 +WireConnection;121;0;120;0 +WireConnection;50;0;37;0 +WireConnection;14;1;72;0 +WireConnection;14;2;11;4 +WireConnection;32;0;52;0 +WireConnection;41;0;39;0 +WireConnection;33;0;34;0 +WireConnection;42;0;38;0 +WireConnection;42;1;43;0 +WireConnection;131;0;124;0 +WireConnection;134;0;59;0 +WireConnection;134;1;138;0 +WireConnection;134;2;136;0 +WireConnection;90;0;120;0 +WireConnection;90;1;77;0 +WireConnection;90;2;14;0 +WireConnection;90;20;125;0 +WireConnection;90;3;132;1 +WireConnection;90;4;132;3 +WireConnection;90;5;132;2 +ASEEND*/ +//CHKSM=67DB5F5F8405F44BD607F54FBA3E8C2ABF9DAEC0 \ No newline at end of file diff --git a/Assets/SLZShaders/ParallaxCubeMap.shader.meta b/Assets/SLZShaders/ParallaxCubeMap.shader.meta new file mode 100644 index 0000000..6a3b775 --- /dev/null +++ b/Assets/SLZShaders/ParallaxCubeMap.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 44cd4284ecfc46c4c97f571b3681e0c6 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/SLZ-Laser.shader b/Assets/SLZShaders/SLZ-Laser.shader new file mode 100644 index 0000000..7b88238 --- /dev/null +++ b/Assets/SLZShaders/SLZ-Laser.shader @@ -0,0 +1,2104 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/Laser" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) + [ASEBegin]_LaserVector3("_LaserVector3", Vector) = (0,0,1,0) + _UVScaler("UV Scaler", Float) = 1 + [HDR]_Color("Color", Color) = (0,1,0,0) + _3dNoise("3dNoise", 3D) = "white" {} + _uniformfog("uniformfog", Range( 0 , 1)) = 0 + _Intensity("Intensity", Float) = 0 + _OffsetFactor("Offset Factor", Int) = 0 + _OffsetUnits("Offset Units", Int) = 0 + [ASEEnd]_MinIntensitiy("Min Intensitiy", Range( 0 , 1)) = 0.1 + + [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) = "" {} + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Transparent" "Queue"="Transparent" } + + Cull Off + AlphaToMask Off + + HLSLINCLUDE + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma target 5.0 + + //#pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForwardOnly" } + + Blend One One, One OneMinusSrcAlpha + ZWrite Off + ZTest LEqual + Offset 0 , 0 + ColorMask RGBA + + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + + + //#pragma multi_compile _ LIGHTMAP_ON + //#pragma multi_compile _ DIRLIGHTMAP_COMBINED + //#pragma shader_feature _ _SAMPLE_GI + //#pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + //#pragma multi_compile _ DEBUG_DISPLAY + #define SHADERPASS SHADERPASS_UNLIT + + + #pragma vertex vert + #pragma fragment frag + + #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/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl" + + + #define ASE_NEEDS_FRAG_WORLD_POSITION + #define ASE_NEEDS_VERT_NORMAL + #define ASE_NEEDS_FRAG_COLOR + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + float4 ase_color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef ASE_FOG + float fogFactor : TEXCOORD2; + #endif + float4 ase_texcoord3 : TEXCOORD3; + float4 ase_color : COLOR; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + float3 _LaserVector3; + int _OffsetUnits; + int _OffsetFactor; + float _MinIntensitiy; + float _Intensity; + float _uniformfog; + float _UVScaler; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler3D _3dNoise; + + + inline float4 GetScreenNoiseRGBASlice27_g6( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + inline float4 GetScreenNoiseRGBASlice27_g5( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + inline float4 GetScreenNoiseRGBASlice27_g7( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + + VertexOutput VertexFunction ( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float3 ase_worldNormal = TransformObjectToWorldNormal(v.ase_normal); + o.ase_texcoord4.xyz = ase_worldNormal; + + o.ase_texcoord3.xy = v.ase_texcoord.xy; + o.ase_color = v.ase_color; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord3.zw = 0; + o.ase_texcoord4.w = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + #ifdef ASE_FOG + o.fogFactor = ComputeFogFactor( positionCS.z ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + float4 ase_color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + o.ase_color = v.ase_color; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag ( VertexOutput IN ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - WorldPosition ); + ase_worldViewDir = normalize(ase_worldViewDir); + float dotResult1 = dot( ase_worldViewDir , _LaserVector3 ); + float clampResult89 = clamp( ( ( dotResult1 + 1.0 ) * 0.5 ) , _MinIntensitiy , 1.0 ); + float2 texCoord103 = IN.ase_texcoord3.xy * float2( 1,1 ) + float2( 0,0 ); + float4 temp_cast_0 = (1.0).xxxx; + float4 lerpResult37 = lerp( ( tex3D( _3dNoise, ( WorldPosition * float3( 0.03333,0.03333,0.03333 ) ) ) * tex3D( _3dNoise, ( WorldPosition * float3( 0.1,0.1,0.1 ) ) ) ) , temp_cast_0 , _uniformfog); + float3 temp_output_135_0 = ( WorldPosition * ( 1.0 / _UVScaler ) ); + float2 temp_output_125_0 = (temp_output_135_0).xy; + float3 ase_worldNormal = IN.ase_texcoord4.xyz; + float3 break137 = abs( ase_worldNormal ); + float temp_output_124_0 = round( break137.y ); + float temp_output_121_0 = ( 1.0 - temp_output_124_0 ); + float temp_output_120_0 = ( round( break137.z ) * temp_output_121_0 ); + float2 temp_output_123_0 = (temp_output_135_0).zy; + float2 temp_output_130_0 = (temp_output_135_0).xz; + float2 temp_output_142_0 = frac( ( ( temp_output_125_0 * temp_output_120_0 ) + ( temp_output_123_0 * ( temp_output_121_0 * ( 1.0 - saturate( temp_output_120_0 ) ) ) ) + ( temp_output_130_0 * temp_output_124_0 ) ) ); + float2 screenUV27_g6 = temp_output_142_0; + float offsetFrame27_g6 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g6 = GetScreenNoiseRGBASlice27_g6( screenUV27_g6 , offsetFrame27_g6 ); + float4 temp_output_109_0_g4 = round( localGetScreenNoiseRGBASlice27_g6 ); + float2 screenUV27_g5 = temp_output_142_0; + float offsetFrame27_g5 = 16.0; + float4 localGetScreenNoiseRGBASlice27_g5 = GetScreenNoiseRGBASlice27_g5( screenUV27_g5 , offsetFrame27_g5 ); + float4 temp_output_156_0 = ( ( temp_output_109_0_g4 * ( 1.0 - ( ( 1.0 - localGetScreenNoiseRGBASlice27_g6 ) * ( 1.0 - localGetScreenNoiseRGBASlice27_g5 ) * 2.0 ) ) ) + ( ( 1.0 - temp_output_109_0_g4 ) * ( localGetScreenNoiseRGBASlice27_g6 * localGetScreenNoiseRGBASlice27_g5 * 2.0 ) ) ); + float4 temp_output_23_0 = ( clampResult89 * _Intensity * ( 1.0 - texCoord103.y ) * IN.ase_color * _Color * lerpResult37 * temp_output_156_0 ); + float2 texCoord162 = IN.ase_texcoord3.xy * float2( 1,1 ) + float2( 0,0 ); + float2 screenUV27_g7 = texCoord162; + float offsetFrame27_g7 = 5.0; + float4 localGetScreenNoiseRGBASlice27_g7 = GetScreenNoiseRGBASlice27_g7( screenUV27_g7 , offsetFrame27_g7 ); + float dotResult157 = dot( temp_output_156_0.x , localGetScreenNoiseRGBASlice27_g7.y ); + + float3 BakedAlbedo = 0; + float3 BakedEmission = 0; + float3 Color = max( ( temp_output_23_0 + ( saturate( (0.0 + (dotResult157 - 0.7) * (1.0 - 0.0) / (1.0 - 0.7)) ) * 5.0 * temp_output_23_0 ) ) , float4( 0,0,0,0 ) ).rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #if defined(_DBUFFER) + ApplyDecalToBaseColor(IN.clipPos, Color); + #endif + + #if defined(_ALPHAPREMULTIPLY_ON) + Color *= Alpha; + #endif + + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_FOG + Color = MixFog( Color, IN.fogFactor ); + #endif + + return half4( Color, Alpha ); + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #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/Color.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + float3 _LaserVector3; + int _OffsetUnits; + int _OffsetFactor; + float _MinIntensitiy; + float _Intensity; + float _uniformfog; + float _UVScaler; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.clipPos = TransformWorldToHClip( positionWS ); + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = o.clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + return 0; + } + ENDHLSL + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend One One, One OneMinusSrcAlpha + ZWrite Off + ZTest LEqual + Offset 0 , 0 + ColorMask RGBA + + + HLSLPROGRAM +#pragma multi_compile_instancing#define _RECEIVE_SHADOWS_OFF 1#define ASE_SRP_VERSION 999999 +#if FALSE + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma shader_feature _ _SAMPLE_GI + #pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ DEBUG_DISPLAY + #define SHADERPASS SHADERPASS_UNLIT + + + #pragma vertex vert + #pragma fragment frag + + #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/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl" + + + #define ASE_NEEDS_FRAG_WORLD_POSITION + #define ASE_NEEDS_VERT_NORMAL + #define ASE_NEEDS_FRAG_COLOR + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + float4 ase_color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef ASE_FOG + float fogFactor : TEXCOORD2; + #endif + float4 ase_texcoord3 : TEXCOORD3; + float4 ase_color : COLOR; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + float3 _LaserVector3; + int _OffsetUnits; + int _OffsetFactor; + float _MinIntensitiy; + float _Intensity; + float _uniformfog; + float _UVScaler; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler3D _3dNoise; + + + inline float4 GetScreenNoiseRGBASlice27_g6( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + inline float4 GetScreenNoiseRGBASlice27_g5( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + inline float4 GetScreenNoiseRGBASlice27_g7( float2 screenUV, float offsetFrame ) + { + return GetScreenNoiseRGBAOffset(screenUV, offsetFrame); + } + + + VertexOutput VertexFunction ( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + float3 ase_worldNormal = TransformObjectToWorldNormal(v.ase_normal); + o.ase_texcoord4.xyz = ase_worldNormal; + + o.ase_texcoord3.xy = v.ase_texcoord.xy; + o.ase_color = v.ase_color; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord3.zw = 0; + o.ase_texcoord4.w = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + #ifdef ASE_FOG + o.fogFactor = ComputeFogFactor( positionCS.z ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + float4 ase_color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + o.ase_color = v.ase_color; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag ( VertexOutput IN ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - WorldPosition ); + ase_worldViewDir = normalize(ase_worldViewDir); + float dotResult1 = dot( ase_worldViewDir , _LaserVector3 ); + float clampResult89 = clamp( ( ( dotResult1 + 1.0 ) * 0.5 ) , _MinIntensitiy , 1.0 ); + float2 texCoord103 = IN.ase_texcoord3.xy * float2( 1,1 ) + float2( 0,0 ); + float4 temp_cast_0 = (1.0).xxxx; + float4 lerpResult37 = lerp( ( tex3D( _3dNoise, ( WorldPosition * float3( 0.03333,0.03333,0.03333 ) ) ) * tex3D( _3dNoise, ( WorldPosition * float3( 0.1,0.1,0.1 ) ) ) ) , temp_cast_0 , _uniformfog); + float3 temp_output_135_0 = ( WorldPosition * ( 1.0 / _UVScaler ) ); + float2 temp_output_125_0 = (temp_output_135_0).xy; + float3 ase_worldNormal = IN.ase_texcoord4.xyz; + float3 break137 = abs( ase_worldNormal ); + float temp_output_124_0 = round( break137.y ); + float temp_output_121_0 = ( 1.0 - temp_output_124_0 ); + float temp_output_120_0 = ( round( break137.z ) * temp_output_121_0 ); + float2 temp_output_123_0 = (temp_output_135_0).zy; + float2 temp_output_130_0 = (temp_output_135_0).xz; + float2 temp_output_142_0 = frac( ( ( temp_output_125_0 * temp_output_120_0 ) + ( temp_output_123_0 * ( temp_output_121_0 * ( 1.0 - saturate( temp_output_120_0 ) ) ) ) + ( temp_output_130_0 * temp_output_124_0 ) ) ); + float2 screenUV27_g6 = temp_output_142_0; + float offsetFrame27_g6 = 0.0; + float4 localGetScreenNoiseRGBASlice27_g6 = GetScreenNoiseRGBASlice27_g6( screenUV27_g6 , offsetFrame27_g6 ); + float4 temp_output_109_0_g4 = round( localGetScreenNoiseRGBASlice27_g6 ); + float2 screenUV27_g5 = temp_output_142_0; + float offsetFrame27_g5 = 16.0; + float4 localGetScreenNoiseRGBASlice27_g5 = GetScreenNoiseRGBASlice27_g5( screenUV27_g5 , offsetFrame27_g5 ); + float4 temp_output_156_0 = ( ( temp_output_109_0_g4 * ( 1.0 - ( ( 1.0 - localGetScreenNoiseRGBASlice27_g6 ) * ( 1.0 - localGetScreenNoiseRGBASlice27_g5 ) * 2.0 ) ) ) + ( ( 1.0 - temp_output_109_0_g4 ) * ( localGetScreenNoiseRGBASlice27_g6 * localGetScreenNoiseRGBASlice27_g5 * 2.0 ) ) ); + float4 temp_output_23_0 = ( clampResult89 * _Intensity * ( 1.0 - texCoord103.y ) * IN.ase_color * _Color * lerpResult37 * temp_output_156_0 ); + float2 texCoord162 = IN.ase_texcoord3.xy * float2( 1,1 ) + float2( 0,0 ); + float2 screenUV27_g7 = texCoord162; + float offsetFrame27_g7 = 5.0; + float4 localGetScreenNoiseRGBASlice27_g7 = GetScreenNoiseRGBASlice27_g7( screenUV27_g7 , offsetFrame27_g7 ); + float dotResult157 = dot( temp_output_156_0.x , localGetScreenNoiseRGBASlice27_g7.y ); + + float3 BakedAlbedo = 0; + float3 BakedEmission = 0; + float3 Color = max( ( temp_output_23_0 + ( saturate( (0.0 + (dotResult157 - 0.7) * (1.0 - 0.0) / (1.0 - 0.7)) ) * 5.0 * temp_output_23_0 ) ) , float4( 0,0,0,0 ) ).rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #if defined(_DBUFFER) + ApplyDecalToBaseColor(IN.clipPos, Color); + #endif + + #if defined(_ALPHAPREMULTIPLY_ON) + Color *= Alpha; + #endif + + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_FOG + Color = MixFog( Color, IN.fogFactor ); + #endif + + return half4( Color, Alpha ); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + float3 _LaserVector3; + int _OffsetUnits; + int _OffsetFactor; + float _MinIntensitiy; + float _Intensity; + float _uniformfog; + float _UVScaler; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + float3 _LaserVector3; + int _OffsetUnits; + int _OffsetFactor; + float _MinIntensitiy; + float _Intensity; + float _uniformfog; + float _UVScaler; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormalsOnly" } + + ZTest LEqual + ZWrite On + + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma multi_compile_fog + #pragma instancing_options renderinglayer + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define VARYINGS_NEED_NORMAL_WS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float3 normalWS : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + float3 _LaserVector3; + int _OffsetUnits; + int _OffsetFactor; + float _MinIntensitiy; + float _Intensity; + float _uniformfog; + float _UVScaler; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal(v.ase_normal); + + o.clipPos = TransformWorldToHClip(positionWS); + o.normalWS.xyz = normalWS; + + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + #if _ALPHATEST_ON + clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + float3 normalWS = IN.normalWS; + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + + } + + ENDHLSL + } + + + Pass + { + + Name "DepthNormalsOnly" + Tags { "LightMode"="DepthNormalsOnly" } + + ZTest LEqual + ZWrite On + + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #define ASE_SRP_VERSION 999999 + + + #pragma exclude_renderers glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD1 + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float3 normalWS : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + float3 _LaserVector3; + int _OffsetUnits; + int _OffsetFactor; + float _MinIntensitiy; + float _Intensity; + float _uniformfog; + float _UVScaler; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal(v.ase_normal); + + o.clipPos = TransformWorldToHClip(positionWS); + o.normalWS.xyz = normalWS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + #if _ALPHATEST_ON + clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + float3 normalWS = IN.normalWS; + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphUnlitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +377;844;1538;1003;670.3203;-409.0567;1.6;True;True +Node;AmplifyShaderEditor.Vector3Node;9;-765.0245,77.5334;Float;False;Property;_LaserVector3;_LaserVector3;0;0;Create;True;0;0;0;False;0;False;0,0,1;1,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.OneMinusNode;122;-1204.418,1552.119;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.Vector3Node;102;-1879.106,-20.05547;Float;False;Constant;_Vector0;Vector 0;11;0;Create;True;0;0;0;False;0;False;-1.39,1.89,-4.4;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.RangedFloatNode;45;560.0096,-50.04142;Float;False;Property;_Intensity;Intensity;8;0;Create;True;0;0;0;False;0;False;0;1;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;22;530.4923,-210.9589;Float;False;Property;_Color;Color;4;1;[HDR];Create;True;0;0;0;False;0;False;0,1,0,0;0,4,0,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.CustomExpressionNode;165;394.6825,1407.596;Inherit;False;GetScreenNoiseRGBASlice(screenUV, offsetFrame);4;Create;2;True;screenUV;FLOAT2;0,0;In;;Inherit;False;True;offsetFrame;INT;0;In;;Inherit;False;GetScreenNoiseRGBASlice;True;False;0;;False;2;0;FLOAT2;0,0;False;1;INT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;35;95.97842,573.3421;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0.1,0.1,0.1;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.ColorNode;40;698.3932,372.058;Float;False;Property;_Color0;Color 0;5;0;Create;True;0;0;0;False;0;False;1,1,1,0;0,0,0,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleAddOpNode;85;-508.457,-465.3818;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.GrabScreenPosition;164;-67.04134,1401.693;Inherit;False;0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SaturateNode;171;1129.72,836.4105;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;52;-993.6301,562.3286;Inherit;True;Property;_TextureSample1;Texture Sample 1;10;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;90;-4.755432,-572.984;Float;False;Property;_MinIntensitiy;Min Intensitiy;11;0;Create;True;0;0;0;False;0;False;0.1;0.2;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;54;-1727.448,538.7517;Inherit;True;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.IntNode;50;1560.539,244.4031;Float;False;Property;_OffsetUnits;Offset Units;10;0;Create;True;0;0;0;True;0;False;0;-2;False;0;1;INT;0 +Node;AmplifyShaderEditor.PosFromTransformMatrix;93;-2172.11,95.77969;Inherit;False;1;0;FLOAT4x4;1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.MMatrixNode;98;-2336.583,24.22546;Inherit;False;0;1;FLOAT4x4;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;43;42.39294,370.058;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0.03333,0.03333,0.03333;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;120;-1642.112,1599.559;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.OneMinusNode;104;-1346.772,-27.76767;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.DotProductOpNode;157;800.3277,1176.545;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.DistanceOpNode;91;195.7296,-44.93008;Inherit;False;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.IntNode;166;295.2147,1532.956;Inherit;False;Constant;_Int0;Int 0;12;0;Create;True;0;0;0;False;0;False;3;0;False;0;1;INT;0 +Node;AmplifyShaderEditor.RangedFloatNode;180;205.533,1323.583;Inherit;False;Constant;_Float4;Float 4;12;0;Create;True;0;0;0;False;0;False;5;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;159;1332.303,500.0184;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;2;False;2;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.OneMinusNode;121;-1864.501,1378.288;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RoundOpNode;118;-1868.552,1599.387;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RoundOpNode;124;-2066.102,1309.488;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;179;-9.467041,1027.583;Inherit;False;Constant;_Float3;Float 3;12;0;Create;True;0;0;0;False;0;False;16;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;117;-1007.621,1520.427;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;103;-1597.772,-42.76767;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.IntNode;49;1545.539,162.4031;Float;False;Property;_OffsetFactor;Offset Factor;9;0;Create;True;0;0;0;True;0;False;0;-2;False;0;1;INT;0 +Node;AmplifyShaderEditor.BreakToComponentsNode;168;800.8196,948.2106;Inherit;False;FLOAT4;1;0;FLOAT4;0,0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 +Node;AmplifyShaderEditor.TexturePropertyNode;33;-55.02156,164.3421;Float;True;Property;_3dNoise;3dNoise;6;0;Create;True;0;0;0;False;0;False;None;6b8eb3f2e6fc9e84ab5b30e166fbe3d6;False;white;LockedToTexture3D;Texture3D;-1;0;2;SAMPLER3D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.RangedFloatNode;21;-2019.661,395.1832;Float;False;Property;_Tiling;Tiling;1;0;Create;True;0;0;0;False;0;False;1;9.96;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;23;975.9696,-43.11742;Inherit;True;7;7;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;6;FLOAT4;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.RelayNode;97;-1410.073,125.6048;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;169;1133.62,646.6105;Inherit;False;Constant;_Float2;Float 2;12;0;Create;True;0;0;0;False;0;False;5;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMaxOpNode;46;1542.521,-45.1845;Inherit;False;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.ViewDirInputsCoordNode;2;-948.9164,-342.8629;Float;False;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.LerpOp;37;964.8276,226.9459;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TriplanarNode;19;-949.024,223.5334;Inherit;True;Spherical;World;False;Top Texture 0;_TopTexture0;gray;-1;None;Mid Texture 0;_MidTexture0;white;-1;None;Bot Texture 0;_BotTexture0;white;-1;None;Triplanar Sampler;Tangent;10;0;SAMPLER2D;;False;5;FLOAT;1;False;1;SAMPLER2D;;False;6;FLOAT;0;False;2;SAMPLER2D;;False;7;FLOAT;0;False;9;FLOAT3;0,0,0;False;8;FLOAT;1;False;3;FLOAT;1;False;4;FLOAT;0;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMaxOpNode;175;-615.0266,1564.239;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;161;-125.2971,1209.448;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.BreakToComponentsNode;172;623.0201,1354.51;Inherit;False;FLOAT4;1;0;FLOAT4;0,0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 +Node;AmplifyShaderEditor.ClampOpNode;89;92.98236,-396.4216;Inherit;True;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SwizzleNode;163;174.9157,1399.383;Inherit;False;FLOAT2;0;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.CustomExpressionNode;173;244.9269,1051.231;Inherit;False;GetScreenNoiseRGBASlice(screenUV, offsetFrame);4;Create;2;True;screenUV;FLOAT2;0,0;In;;Inherit;False;True;offsetFrame;INT;0;In;;Inherit;False;GetScreenNoiseRGBASlice;True;False;0;;False;2;0;FLOAT2;0,0;False;1;INT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.RangedFloatNode;42;786.3932,583.058;Float;False;Constant;_Float0;Float 0;6;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.FunctionNode;160;333.9028,1204.648;Inherit;False;Global Blue Noise Sample;-1;;7;bac712bbbce65c14c9d4cbc808f3d0e0;0;2;8;FLOAT2;0,0;False;10;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.FunctionNode;156;581.4297,789.1207;Inherit;False;Overlay Blend;-1;;4;3987f7f74cd16f24eab3a89e587abb46;0;2;1;FLOAT4;1,1,1,1;False;2;FLOAT4;0.5,0.5,0.5,0.5019608;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.DotProductOpNode;1;-729.9703,-305.5392;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.DistanceOpNode;95;-1838.11,144.7797;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ObjectToWorldMatrixNode;94;-2491.452,72.9053;Inherit;False;0;1;FLOAT4x4;0 +Node;AmplifyShaderEditor.SamplerNode;34;261.9786,495.3421;Inherit;True;Property;_TextureSample0;Texture Sample 0;4;0;Create;True;0;0;0;False;0;False;-1;None;None;True;1;False;white;LockedToTexture3D;False;Instance;-1;Auto;Texture3D;8;0;SAMPLER3D;;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;38;688.7901,228.2423;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;133;-486.1653,1029.578;Inherit;True;3;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.RangedFloatNode;41;987.3932,501.058;Float;False;Property;_uniformfog;uniformfog;7;0;Create;True;0;0;0;False;0;False;0;0.13;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;96;-1592.11,108.7797;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.VectorFromMatrixNode;101;-2138.085,-28.02408;Inherit;False;Row;3;1;0;FLOAT4x4;1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.VertexColorNode;48;565.2511,41.31428;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.FractNode;64;-1438.407,604.4266;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SamplerNode;26;264.9662,277.1747;Inherit;True;Property;_VLB_NoiseTex3D;_VLB_NoiseTex3D;4;0;Create;True;0;0;0;False;0;False;-1;None;None;True;1;False;white;LockedToTexture3D;False;Instance;-1;Auto;Texture3D;8;0;SAMPLER3D;;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.TFHCRemapNode;167;1073.953,1109.311;Inherit;True;5;0;FLOAT;0;False;1;FLOAT;0.7;False;2;FLOAT;1;False;3;FLOAT;0;False;4;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TexturePropertyNode;20;-1409.024,223.5334;Float;True;Property;_Noise;Noise;3;0;Create;True;0;0;0;False;0;False;None;None;False;gray;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.WorldPosInputsNode;53;-2453.63,395.3286;Float;True;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SwizzleNode;130;-1343.046,1240.307;Inherit;True;FLOAT2;0;2;2;3;1;0;FLOAT3;0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMaxOpNode;176;-652.7266,1670.839;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.FunctionNode;155;251.5327,903.8068;Inherit;False;Global Blue Noise Sample;-1;;5;bac712bbbce65c14c9d4cbc808f3d0e0;0;2;8;FLOAT2;0,0;False;10;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.WorldPosInputsNode;31;-190.0337,397.1747;Float;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SimpleAddOpNode;170;1353.32,47.31042;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;162;34.70332,1203.048;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;135;-1600.812,1020.039;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.WorldToObjectMatrix;99;-2446.205,200.4091;Inherit;False;0;1;FLOAT4x4;0 +Node;AmplifyShaderEditor.BreakToComponentsNode;137;-2400,1335.081;Inherit;True;FLOAT3;1;0;FLOAT3;0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 +Node;AmplifyShaderEditor.SimpleDivideOpNode;116;-1754.299,880.9258;Inherit;False;2;0;FLOAT;1;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;127;-1934.299,874.9258;Inherit;False;Property;_UVScaler;UV Scaler;2;0;Create;True;0;0;0;False;0;False;1;0.3;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SaturateNode;178;-1318.326,1668.238;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.AbsOpNode;126;-2612.519,1312.915;Inherit;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.WorldPosInputsNode;128;-1940.448,1017.181;Inherit;True;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.WorldNormalVector;115;-2914.623,1308.964;Inherit;True;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;134;-753.3325,1252.033;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;129;-754.0272,1023.592;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.FunctionNode;143;239.9672,784.9895;Inherit;False;Global Blue Noise Sample;-1;;6;bac712bbbce65c14c9d4cbc808f3d0e0;0;2;8;FLOAT2;0,0;False;10;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.FractNode;142;-224.2212,1032.899;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SwizzleNode;123;-1353.046,1021.607;Inherit;True;FLOAT2;2;1;2;3;1;0;FLOAT3;0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SwizzleNode;125;-1349.146,788.5071;Inherit;True;FLOAT2;0;1;2;3;1;0;FLOAT3;0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;86;-244.457,-467.3818;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;138;-755.5521,805.4412;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;146;1979.189,-117.194;Half;False;True;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;SLZ/Laser;2992e84f91cbeb14eab234972e07ea9d;True;Forward;0;1;Forward;8;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;1;False;-1;1;1;False;-1;10;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;2;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=UniversalForwardOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;22;Surface;1;637976943672417564; Blend;2;637976943711661604;Two Sided;0;637976943747624774;Cast Shadows;0;637976943682889326; Use Shadow Threshold;0;0;Receive Shadows;0;637976943691446800;GPU Instancing;1;0;LOD CrossFade;0;0;Built-in Fog;0;0;DOTS Instancing;0;0;Meta Pass;0;0;Extra Pre Pass;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Vertex Position,InvertActionOnDeselection;1;0;0;10;False;True;False;True;False;True;True;True;True;True;False;;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;148;1979.189,-117.194;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;153;1979.189,-117.194;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthNormals;0;8;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormalsOnly;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;151;1979.189,-117.194;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;SceneSelectionPass;0;6;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;152;1979.189,-117.194;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ScenePickingPass;0;7;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;145;1979.189,-117.194;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;154;1979.189,-117.194;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthNormalsOnly;0;9;DepthNormalsOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormalsOnly;False;True;15;d3d9;d3d11_9x;d3d11;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;149;1979.189,-117.194;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;147;1979.189,-117.194;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;150;1979.189,-117.194;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;1;False;-1;1;1;False;-1;10;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;2;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +WireConnection;122;0;178;0 +WireConnection;165;0;142;0 +WireConnection;165;1;166;0 +WireConnection;35;0;31;0 +WireConnection;85;0;1;0 +WireConnection;171;0;167;0 +WireConnection;52;0;20;0 +WireConnection;54;0;53;0 +WireConnection;54;1;21;0 +WireConnection;93;0;99;0 +WireConnection;43;0;31;0 +WireConnection;120;0;118;0 +WireConnection;120;1;121;0 +WireConnection;104;0;103;2 +WireConnection;157;0;168;0 +WireConnection;157;1;172;1 +WireConnection;159;0;171;0 +WireConnection;159;1;169;0 +WireConnection;159;2;23;0 +WireConnection;121;0;124;0 +WireConnection;118;0;137;2 +WireConnection;124;0;137;1 +WireConnection;117;0;121;0 +WireConnection;117;1;122;0 +WireConnection;168;0;156;0 +WireConnection;23;0;89;0 +WireConnection;23;1;45;0 +WireConnection;23;2;97;0 +WireConnection;23;3;48;0 +WireConnection;23;4;22;0 +WireConnection;23;5;37;0 +WireConnection;23;6;156;0 +WireConnection;97;0;104;0 +WireConnection;46;0;170;0 +WireConnection;37;0;38;0 +WireConnection;37;1;42;0 +WireConnection;37;2;41;0 +WireConnection;19;0;20;0 +WireConnection;19;3;21;0 +WireConnection;175;0;125;0 +WireConnection;175;1;123;0 +WireConnection;172;0;160;0 +WireConnection;89;0;86;0 +WireConnection;89;1;90;0 +WireConnection;163;0;164;0 +WireConnection;173;0;142;0 +WireConnection;160;8;162;0 +WireConnection;160;10;180;0 +WireConnection;156;1;143;0 +WireConnection;156;2;155;0 +WireConnection;1;0;2;0 +WireConnection;1;1;9;0 +WireConnection;95;0;102;0 +WireConnection;95;1;53;0 +WireConnection;34;0;33;0 +WireConnection;34;1;35;0 +WireConnection;38;0;26;0 +WireConnection;38;1;34;0 +WireConnection;133;0;138;0 +WireConnection;133;1;129;0 +WireConnection;133;2;134;0 +WireConnection;96;0;95;0 +WireConnection;101;0;98;0 +WireConnection;64;0;54;0 +WireConnection;26;0;33;0 +WireConnection;26;1;43;0 +WireConnection;167;0;157;0 +WireConnection;130;0;135;0 +WireConnection;176;0;130;0 +WireConnection;176;1;175;0 +WireConnection;155;8;142;0 +WireConnection;155;10;179;0 +WireConnection;170;0;23;0 +WireConnection;170;1;159;0 +WireConnection;135;0;128;0 +WireConnection;135;1;116;0 +WireConnection;137;0;126;0 +WireConnection;116;1;127;0 +WireConnection;178;0;120;0 +WireConnection;126;0;115;0 +WireConnection;134;0;130;0 +WireConnection;134;1;124;0 +WireConnection;129;0;123;0 +WireConnection;129;1;117;0 +WireConnection;143;8;142;0 +WireConnection;142;0;133;0 +WireConnection;123;0;135;0 +WireConnection;125;0;135;0 +WireConnection;86;0;85;0 +WireConnection;138;0;125;0 +WireConnection;138;1;120;0 +WireConnection;146;2;46;0 +ASEEND*/ +//CHKSM=FE74AF0220BCC755569F07C8FCC60E8253195F46 \ No newline at end of file diff --git a/Assets/SLZShaders/SLZ-Laser.shader.meta b/Assets/SLZShaders/SLZ-Laser.shader.meta new file mode 100644 index 0000000..610754f --- /dev/null +++ b/Assets/SLZShaders/SLZ-Laser.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: f05a5c6a2a705054d8547ebd87b58073 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/SLZAnime.shader b/Assets/SLZShaders/SLZAnime.shader new file mode 100644 index 0000000..6d423bf --- /dev/null +++ b/Assets/SLZShaders/SLZAnime.shader @@ -0,0 +1,2573 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/Anime" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) + [ASEBegin]_BaseMap("Base Map", 2D) = "white" {} + [NoScaleOffset]g_tBRDFMap("BRDF map", 2D) = "white" {} + [HideInInspector][Toggle(_BRDFMAP)] BRDFMAP1("Enable BRDF map", Float) = 1 + [HideInInspector][Toggle(ANIME)] ANIME("ANIME", Float) = 1 + [NoScaleOffset][SingleLineTexture]_MetallicGlossMap("MAS", 2D) = "white" {} + [HDR]_OutlineColor("Outline Color", Color) = (0.5,0.5,0.5,0) + _BumpMap("Bump Map", 2D) = "bump" {} + _Color("Color", Color) = (1,1,1,1) + _OutlineSize("Outline Size", Float) = 5 + [ASEEnd]_OutlineClamp("Outline Clamp", Float) = 10 + [HideInInspector] _texcoord( "", 2D ) = "white" {} + + [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) = "" {} + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + + + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" } + Cull Back + ZWrite On + ZTest LEqual + Offset 0,0 + AlphaToMask Off + + HLSLINCLUDE + #pragma target 4.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForward" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_FORWARD + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.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.core/ShaderLibrary/TextureStack.hlsl" + + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + #pragma shader_feature_local ANIME + #pragma shader_feature_local _BRDFMAP + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.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.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _Color; + float4 _OutlineColor; + float4 _BumpMap_ST; + float _OutlineSize; + float _OutlineClamp; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + TEXTURE2D(_BumpMap); + SAMPLER(sampler_BumpMap); + TEXTURE2D(_MetallicGlossMap); + SAMPLER(sampler_MetallicGlossMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + #endif + + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) || defined(ASE_TERRAIN_INSTANCING) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 uv_BaseMap = IN.ase_texcoord8.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float4 temp_output_109_0_g2 = round( ( SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ) * _Color ) ); + float dotResult19 = dot( WorldNormal , WorldViewDirection ); + float4 lerpResult22 = lerp( ( ( temp_output_109_0_g2 * ( 1.0 - ( ( 1.0 - ( SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ) * _Color ) ) * ( 1.0 - _OutlineColor ) * 2.0 ) ) ) + ( ( 1.0 - temp_output_109_0_g2 ) * ( ( SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ) * _Color ) * _OutlineColor * 2.0 ) ) ) , ( SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ) * _Color ) , saturate( ( pow( dotResult19 , _OutlineSize ) * _OutlineClamp ) )); + + float2 uv_BumpMap = IN.ase_texcoord8.xy * _BumpMap_ST.xy + _BumpMap_ST.zw; + + float2 uv_MetallicGlossMap56 = IN.ase_texcoord8.xy; + float4 tex2DNode56 = SAMPLE_TEXTURE2D( _MetallicGlossMap, sampler_MetallicGlossMap, uv_MetallicGlossMap56 ); + + float3 Albedo = lerpResult22.rgb; + float3 Normal = UnpackNormalScale( SAMPLE_TEXTURE2D_BIAS( _BumpMap, sampler_BumpMap, uv_BumpMap, 0.0 ), 1.0f ); + float3 Emission = 0; +#if 0 + float3 BakedEmission = 0; +#endif + float3 Specular = 0.5; + float Metallic = tex2DNode56.r; + float Smoothness = tex2DNode56.b; + float Occlusion = tex2DNode56.g; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _CLEARCOAT + float CoatMask = 0; + float CoatSmoothness = 0; + #endif + + #if defined(_FLUORESCENCE) + float4 Fluorescence = 0; + float4 Absorbance = 0; + #endif + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = ShadowCoords; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + + #ifdef ASE_FOG + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzww; //TODO: Shuffle things in vertex streams so we get full RGBA color rather than RGBB here + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xyz, IN.dynamicLightmapUV.xy, IN.vertexSH, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, IN.vertexSH , inputData.normalWS); + #endif + + #else + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + #endif + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = Albedo; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + #if defined(_FLUORESCENCE) + surfaceData.fluorescence = Fluorescence; + surfaceData.absorbance = Absorbance; + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData); + #endif + + half4 color = UniversalFragmentPBR( inputData, surfaceData); + + #ifdef LIGHTMAP_ON + float3 MetalSpec = lerp(kDieletricSpec.rgb, surfaceData.albedo , surfaceData.metallic); + color.rgb += BakedSpecular * surfaceData.occlusion * MetalSpec * inputData.bakedGI.rgb; + #endif + + #ifdef _TRANSMISSION_ASE + { + float shadow = _TransmissionShadow; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; + color.rgb += Albedo * mainTransmission; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; + color.rgb += Albedo * transmission; + } + #endif + } + #endif + + #ifdef _TRANSLUCENCY_ASE + { + float shadow = _TransShadow; + float normal = _TransNormal; + float scattering = _TransScattering; + float direct = _TransDirect; + float ambient = _TransAmbient; + float strength = _TransStrength; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + + half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; + half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); + half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * mainTranslucency * strength; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 lightDir = light.direction + inputData.normalWS * normal; + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * translucency * strength; + } + #endif + } + #endif + + #ifdef _REFRACTION_ASE + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, IN.fogFactorAndVertexLight.x); + #endif + #endif + + color = Volumetrics( color, inputData.positionWS); + + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return color; + } + + ENDHLSL + } + + + Pass + { + + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #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" + + #pragma shader_feature_local ANIME + #pragma shader_feature_local _BRDFMAP + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _Color; + float4 _OutlineColor; + float4 _BumpMap_ST; + float _OutlineSize; + float _OutlineClamp; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + float3 _LightDirection; + float3 _LightPosition; + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + float3 normalWS = TransformObjectToWorldDir(v.ase_normal); + + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + float2 vShadowOffsets = GetShadowOffsets( normalWS, lightDirectionWS ); + positionWS.xyz -= vShadowOffsets.y * lightDirectionWS.xyz * .01; + float4 clipPos = TransformObjectToHClip( float4( mul( unity_WorldToObject, float4( positionWS.xyz, 1.0 ) ).xyz, 1.0 ) ); + //float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + #if UNITY_REVERSED_Z + clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #else + clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #endif + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = clipPos; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + return 0; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + #pragma shader_feature_local ANIME + #pragma shader_feature_local _BRDFMAP + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _Color; + float4 _OutlineColor; + float4 _BumpMap_ST; + float _OutlineSize; + float _OutlineClamp; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "Universal2D" + Tags{"LightMode" = "Universal2D"} + + Blend One Zero + ColorMask RGBA + + HLSLPROGRAM + + /*ase_pragma_before*/ + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_2D + + #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" + + /*ase_pragma*/ + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + /*ase_interp(2,):sp=sp;wp=tc0;sc=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + /*ase_srp_batcher*/ + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + /*ase_globals*/ + + /*ase_funcs*/ + + VertexOutput VertexFunction( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID( v ); + UNITY_TRANSFER_INSTANCE_ID( v, o ); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_Normal*/v.ase_normal/*end*/; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + /*ase_control_code:v=VertexInput;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + /*ase_domain_code:patch=VertexControl;o=VertexInput;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN /*ase_frag_input*/ ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:IN=VertexOutput*/ + + float3 Albedo = /*ase_frag_out:Albedo;Float3;0;-1;_Albedo*/float3(0.5, 0.5, 0.5)/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;2;-1;_AlphaClip*/0.5/*end*/; + + half4 color = half4( Albedo, Alpha ); + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + return color; + } + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormals" } + + ZWrite On + Blend One Zero + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/Color.hlsl" + + #pragma shader_feature_local ANIME + #pragma shader_feature_local _BRDFMAP + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _Color; + float4 _OutlineColor; + float4 _BumpMap_ST; + float _OutlineSize; + float _OutlineClamp; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BumpMap); + SAMPLER(sampler_BumpMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord4.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal( v.ase_normal ); + float4 tangentWS = float4(TransformObjectToWorldDir( v.ase_tangent.xyz), v.ase_tangent.w); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + float3 WorldNormal = IN.worldNormal; + float4 WorldTangent = IN.worldTangent; + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 uv_BumpMap = IN.ase_texcoord4.xy * _BumpMap_ST.xy + _BumpMap_ST.zw; + + float3 Normal = UnpackNormalScale( SAMPLE_TEXTURE2D_BIAS( _BumpMap, sampler_BumpMap, uv_BumpMap, 0.0 ), 1.0f ); + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + return half4(packedNormalWS, 0.0); + #else + + #if defined(_NORMALMAP) + #if _NORMAL_DROPOFF_TS + float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz); + float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz)); + #elif _NORMAL_DROPOFF_OS + float3 normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + float3 normalWS = Normal; + #endif + #else + float3 normalWS = WorldNormal; + #endif + + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + #endif + } + ENDHLSL + } + + + Pass + { + + Name "GBuffer" + Tags { "LightMode"="UniversalGBuffer" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM +#define _NORMAL_DROPOFF_TS 1#pragma multi_compile_fog#define ASE_FOG 1#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED#define _DISABLE_LIGHTMAPS#define _NORMALMAP 1#define ASE_SRP_VERSION 999999#define ASE_USING_SAMPLING_MACROS 1 +#if FALSE + #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_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 _ _MIXED_LIGHTING_SUBTRACTIVE + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _GBUFFER_NORMALS_OCT + //#pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile _ _RENDER_PASS_ENABLED + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_GBUFFER + + #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/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + #pragma shader_feature_local ANIME + #pragma shader_feature_local _BRDFMAP + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + float4 _Color; + float4 _OutlineColor; + float4 _BumpMap_ST; + float _OutlineSize; + float _OutlineClamp; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + TEXTURE2D(_BumpMap); + SAMPLER(sampler_BumpMap); + TEXTURE2D(_MetallicGlossMap); + SAMPLER(sampler_MetallicGlossMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + FragmentOutput frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #else + ShadowCoords = float4(0, 0, 0, 0); + #endif + + + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 uv_BaseMap = IN.ase_texcoord8.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + float4 temp_output_109_0_g2 = round( ( SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ) * _Color ) ); + float dotResult19 = dot( WorldNormal , WorldViewDirection ); + float4 lerpResult22 = lerp( ( ( temp_output_109_0_g2 * ( 1.0 - ( ( 1.0 - ( SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ) * _Color ) ) * ( 1.0 - _OutlineColor ) * 2.0 ) ) ) + ( ( 1.0 - temp_output_109_0_g2 ) * ( ( SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ) * _Color ) * _OutlineColor * 2.0 ) ) ) , ( SAMPLE_TEXTURE2D( _BaseMap, sampler_BaseMap, uv_BaseMap ) * _Color ) , saturate( ( pow( dotResult19 , _OutlineSize ) * _OutlineClamp ) )); + + float2 uv_BumpMap = IN.ase_texcoord8.xy * _BumpMap_ST.xy + _BumpMap_ST.zw; + + float2 uv_MetallicGlossMap56 = IN.ase_texcoord8.xy; + float4 tex2DNode56 = SAMPLE_TEXTURE2D( _MetallicGlossMap, sampler_MetallicGlossMap, uv_MetallicGlossMap56 ); + + float3 Albedo = lerpResult22.rgb; + float3 Normal = UnpackNormalScale( SAMPLE_TEXTURE2D_BIAS( _BumpMap, sampler_BumpMap, uv_BumpMap, 0.0 ), 1.0f ); + float3 Emission = 0; + float3 Specular = 0.5; + float Metallic = tex2DNode56.r; + float Smoothness = tex2DNode56.b; + float Occlusion = tex2DNode56.g; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = IN.clipPos; + inputData.shadowCoord = ShadowCoords; + + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + #else + inputData.normalWS = WorldNormal; + #endif + + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + inputData.viewDirectionWS = SafeNormalize( WorldViewDirection ); + + + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(WorldPosition, 1.0), IN.fogFactorAndVertexLight.x); + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.clipPos, + Albedo, + Specular, + inputData.normalWS, + Metallic, + Occlusion, + Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData + (Albedo, Metallic, Specular, Smoothness, Alpha, brdfData); + + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + half4 color; + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + color.a = Alpha; + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb); + } +#endif + ENDHLSL + } + + + /*ase_pass*/ + Pass + { + + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + HLSLPROGRAM + + /*ase_pragma_before*/ + + #pragma only_renderers gles gles3 glcore d3d11 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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" + + /*ase_pragma*/ + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + /*ase_srp_batcher*/ + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/v.ase_normal/*end*/; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + /*ase_control_code:v=VertexInput;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + /*ase_domain_code:patch=VertexControl;o=VertexInput;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN /*ase_frag_input*/) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + /*ase_frag_code:IN=VertexOutput*/ + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + surfaceDescription.AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphLitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +282;389;1538;967;-251.4649;56.78186;1;True;True +Node;AmplifyShaderEditor.WorldNormalVector;20;-1178.038,-800.0544;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.ViewDirInputsCoordNode;21;-1164.038,-646.0543;Inherit;False;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.SamplerNode;12;-626,-130.5;Inherit;True;Property;_BaseMap;Base Map;0;0;Create;True;0;0;0;False;0;False;-1;None;1b0370b3c9a51e344837a960d4e98216;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.DotProductOpNode;19;-948.3429,-690.2742;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;58;-535.4602,65.32556;Inherit;False;Property;_Color;Color;7;0;Create;True;0;0;0;False;0;False;1,1,1,1;1,1,1,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;64;-881.8295,-829.9539;Inherit;False;Property;_OutlineSize;Outline Size;8;0;Create;True;0;0;0;False;0;False;5;5;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;57;-277.4602,-118.6744;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.RangedFloatNode;65;-894.0175,-923.028;Inherit;False;Property;_OutlineClamp;Outline Clamp;9;0;Create;True;0;0;0;False;0;False;10;10;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.PowerNode;61;-722.274,-842.1419;Inherit;False;False;2;0;FLOAT;0;False;1;FLOAT;3.46;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;23;-202.9191,-515.0224;Inherit;False;Property;_OutlineColor;Outline Color;5;1;[HDR];Create;True;0;0;0;False;0;False;0.5,0.5,0.5,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;62;-571.5825,-833.2779;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RelayNode;31;-117.7546,-132.4103;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SaturateNode;63;-390.9748,-808.9012;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FunctionNode;26;65.0983,-395.4177;Inherit;True;Overlay Blend;-1;;2;3987f7f74cd16f24eab3a89e587abb46;0;2;1;COLOR;1,1,1,1;False;2;COLOR;0.5,0.5,0.5,0.5019608;False;1;COLOR;0 +Node;AmplifyShaderEditor.SamplerNode;56;803.6033,-89.51141;Inherit;True;Property;_MetallicGlossMap;MAS;4;2;[NoScaleOffset];[SingleLineTexture];Create;False;0;0;0;False;0;False;-1;None;bf9e26486b4e6724cbf6c1b8d641c6f3;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.OneMinusNode;42;177.5196,-14.34025;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TexturePropertyNode;32;788.3314,473.3041;Inherit;True;Property;g_tBRDFMap;BRDF map;1;1;[NoScaleOffset];Fetch;False;0;0;0;True;0;False;a3bdd83838d6c4b40aafefcae6402faf;6dc78741d54741a4c90a0fb74bd75f20;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.SamplerNode;39;364.7328,87.02249;Inherit;True;Property;_BumpMap;Bump Map;6;0;Create;True;0;0;0;False;0;False;-1;None;d840231ec2f3db34a802f4b2d03b1ce9;True;0;True;bump;Auto;True;Object;-1;MipBias;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.StaticSwitch;66;1090.453,366.7114;Inherit;False;Property;ANIME;ANIME;3;0;Create;False;0;0;0;True;1;HideInInspector;False;0;1;1;True;ANIME;Toggle;2;Key0;Key1;Create;True;False;All;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.LerpOp;22;411.7003,-254;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.StaticSwitch;36;786.2081,367.3107;Inherit;False;Property;BRDFMAP1;Enable BRDF map;2;0;Create;False;0;0;0;True;1;HideInInspector;False;0;1;1;True;_BRDFMAP;Toggle;2;Key0;Key1;Create;True;False;All;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;43;204.8196,107.8598;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;5;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;6;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;5;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;1;0,-154.2;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;9;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;7;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormals;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;2;1103.537,-158.6321;Half;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;SLZ/Anime;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;23;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;True;1;False;-1;True;3;False;-1;True;False;-1;False;-1;-1;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;4;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalForward;False;False;0;Hidden/InternalErrorShader;0;0;Standard;48;Workflow;1;0;Surface;0;637847984488696701; Refraction Model;0;0; Blend;0;0;Two Sided;1;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Transmission;0;0; Transmission Shadow;0.5,False,-1;0;Translucency;0;0; Translucency Strength;1,False,-1;0; Normal Distortion;0.5,False,-1;0; Scattering;2,False,-1;0; Direct;0.9,False,-1;0; Ambient;0.1,False,-1;0; Shadow;0.5,False,-1;0;Cast Shadows;1;637849008675289663; Use Shadow Threshold;0;0;Receive Shadows;1;0;GPU Instancing;0;637848059191800682;LOD CrossFade;0;637847983780200660;Built-in Fog;1;0;Lightmaps;0;637956961665508411;Volumetrics;1;0;Decals;0;637849004488270298;Screen Space Occlusion;1;0;Reflection Probe Blend/Projection;1;0;Light Layers;0;637849004259350588;_FinalColorxAlpha;0;637848253284931523;Meta Pass;0;637956962340762388;GBuffer Pass;0;0;Override Baked GI;0;0;Extra Pre Pass;0;0;DOTS Instancing;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Write Depth;0;637848252840677912; Early Z;0;0;Vertex Position,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;0;0;Fluorescence;0;0;0;10;False;True;True;True;False;False;True;True;False;False;False;;True;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;3;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;8;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;4;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;10;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +WireConnection;19;0;20;0 +WireConnection;19;1;21;0 +WireConnection;57;0;12;0 +WireConnection;57;1;58;0 +WireConnection;61;0;19;0 +WireConnection;61;1;64;0 +WireConnection;62;0;61;0 +WireConnection;62;1;65;0 +WireConnection;31;0;57;0 +WireConnection;63;0;62;0 +WireConnection;26;1;31;0 +WireConnection;26;2;23;0 +WireConnection;42;0;19;0 +WireConnection;22;0;26;0 +WireConnection;22;1;31;0 +WireConnection;22;2;63;0 +WireConnection;43;0;42;0 +WireConnection;2;0;22;0 +WireConnection;2;1;39;0 +WireConnection;2;3;56;1 +WireConnection;2;4;56;3 +WireConnection;2;5;56;2 +ASEEND*/ +//CHKSM=314A70616A5EB7D01FEF6EC6C063946CE320E6E3 \ No newline at end of file diff --git a/Assets/SLZShaders/SLZAnime.shader.meta b/Assets/SLZShaders/SLZAnime.shader.meta new file mode 100644 index 0000000..b9df5fb --- /dev/null +++ b/Assets/SLZShaders/SLZAnime.shader.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 97791a0150e87a14bbe1a5d46267be8a +ShaderImporter: + externalObjects: {} + defaultTextures: + - _BaseMap: {instanceID: 0} + - g_tBRDFMap: {instanceID: 0} + - _MetallicGlossMap: {fileID: 2800000, guid: 703311043c2b2a14fa1fd24eec4d6b39, type: 3} + - _BumpMap: {instanceID: 0} + - _texcoord: {instanceID: 0} + - unity_Lightmaps: {instanceID: 0} + - unity_LightmapsInd: {instanceID: 0} + - unity_ShadowMasks: {instanceID: 0} + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Scanline.shader b/Assets/SLZShaders/Scanline.shader new file mode 100644 index 0000000..ef71b87 --- /dev/null +++ b/Assets/SLZShaders/Scanline.shader @@ -0,0 +1,3315 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/Scanline" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [ASEBegin][NoScaleOffset]_EmissionMap("Emission Map", 2D) = "white" {} + _MainTex("MainTex", 2D) = "white" {} + _Color("Color", Color) = (1,1,1,1) + [HDR]_EmissionColor("Emission Color", Color) = (0,0,0,0) + _Glossiness("Glossiness", Range( 0 , 1)) = 1 + _Metallic("Metallic", Range( 0 , 1)) = 0 + _EmissionFalloff("Emission Falloff", Range( 0 , 5)) = 1 + _ScanlineSpeed("Scanline Speed", Float) = 0.1 + _ScanlineIntensity("Scanline Intensity", Range( 0 , 1)) = 0.5 + _ScanlineCount("Scanline Count", Float) = 32 + _Pixels("Pixels", 2D) = "white" {} + _Fluorescence("Fluorescence", Color) = (0.4083748,0.5377358,0.4464222,1) + _Absorbance("Absorbance", Color) = (0.042,0.112,0.517,1) + [ASEEnd]_CoatSmoothness("Coat Smoothness", Range( 0 , 1)) = 0 + [HideInInspector] _texcoord( "", 2D ) = "white" {} + + [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) = "" {} + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + +HLSLINCLUDE +#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" +ENDHLSL + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" } + Cull Back + ZWrite On + ZTest LEqual + Offset 0 , 0 + AlphaToMask Off + + HLSLINCLUDE + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForwardOnly" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _CLEARCOAT 1 + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_FORWARD + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.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.core/ShaderLibrary/TextureStack.hlsl" + + #define ASE_NEEDS_FRAG_WORLD_NORMAL + #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.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.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _Pixels_TexelSize; + float4 _Pixels_ST; + float4 _EmissionColor; + float4 _Fluorescence; + float4 _Absorbance; + float _ScanlineSpeed; + float _ScanlineCount; + float _ScanlineIntensity; + float _EmissionFalloff; + float _Metallic; + float _Glossiness; + float _CoatSmoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + TEXTURE2D(_EmissionMap); + TEXTURE2D(_Pixels); + SAMPLER(sampler_EmissionMap); + SAMPLER(sampler_Pixels); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 uv_MainTex = IN.ase_texcoord8.xy * _MainTex_ST.xy + _MainTex_ST.zw; + float4 temp_output_7_0 = ( SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, uv_MainTex ) * _Color ); + + float2 uv_Pixels = IN.ase_texcoord8.xy * _Pixels_ST.xy + _Pixels_ST.zw; + float2 appendResult51 = (float2(uv_MainTex.x , ( uv_MainTex.y + ( ( 0.2 / _Pixels_TexelSize.w ) * round( frac( ( _TimeParameters.x * 10.0 ) ) ) * round( frac( ( uv_Pixels.y * 0.5 ) ) ) ) ))); + float2 texCoord23 = IN.ase_texcoord8.xy * float2( 1,1 ) + float2( 0,0 ); + float lerpResult32 = lerp( 1.0 , distance( frac( ( ( texCoord23.y + frac( ( _TimeParameters.x * _ScanlineSpeed ) ) ) * _ScanlineCount ) ) , 0.5 ) , _ScanlineIntensity); + float4 temp_output_8_0 = ( SAMPLE_TEXTURE2D( _EmissionMap, sampler_EmissionMap, appendResult51 ) * _EmissionColor * lerpResult32 * ( SAMPLE_TEXTURE2D( _Pixels, sampler_Pixels, uv_Pixels ) * 1.0 ) ); + float dotResult16 = dot( WorldNormal , WorldViewDirection ); + float clampResult22 = clamp( pow( abs( dotResult16 ) , ( _EmissionFalloff * 2.0 ) ) , 0.0 , 1.0 ); + + float3 Albedo = temp_output_7_0.rgb; + float3 Normal = float3(0, 0, 1); + float3 Emission = ( temp_output_8_0 * clampResult22 ).rgb; +#if 0 + float3 BakedEmission = 0; +#endif + float3 Specular = 0.5; + float Metallic = _Metallic; + float Smoothness = _Glossiness; + float Occlusion = 1; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _CLEARCOAT + float CoatMask = 1.0; + float CoatSmoothness = _CoatSmoothness; + #endif + + #if defined(_FLUORESCENCE) + float4 Fluorescence = _Fluorescence; + float4 Absorbance = _Absorbance; + #endif + + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = ShadowCoords; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + + #ifdef ASE_FOG + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzww; //TODO: Shuffle things in vertex streams so we get full RGBA color rather than RGBB here + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xyz, IN.dynamicLightmapUV.xy, IN.vertexSH, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, IN.vertexSH , inputData.normalWS); + #endif + + #else + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + #endif + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = Albedo; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + #if defined(_FLUORESCENCE) + surfaceData.fluorescence = Fluorescence; + surfaceData.absorbance = Absorbance; + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData); + #endif + + half4 color = UniversalFragmentPBR( inputData, surfaceData); + + #ifdef LIGHTMAP_ON + float3 MetalSpec = lerp(kDieletricSpec.rgb, surfaceData.albedo , surfaceData.metallic); + color.rgb += BakedSpecular * surfaceData.occlusion * MetalSpec * inputData.bakedGI.rgb; + #endif + + #ifdef _TRANSMISSION_ASE + { + float shadow = _TransmissionShadow; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; + color.rgb += Albedo * mainTransmission; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; + color.rgb += Albedo * transmission; + } + #endif + } + #endif + + #ifdef _TRANSLUCENCY_ASE + { + float shadow = _TransShadow; + float normal = _TransNormal; + float scattering = _TransScattering; + float direct = _TransDirect; + float ambient = _TransAmbient; + float strength = _TransStrength; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + + half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; + half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); + half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * mainTranslucency * strength; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 lightDir = light.direction + inputData.normalWS * normal; + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * translucency * strength; + } + #endif + } + #endif + + #ifdef _REFRACTION_ASE + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, IN.fogFactorAndVertexLight.x); + #endif + #endif + + color = Volumetrics( color, inputData.positionWS); + + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return color; + } + + ENDHLSL + } + + + Pass + { + + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _CLEARCOAT 1 + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _Pixels_TexelSize; + float4 _Pixels_ST; + float4 _EmissionColor; + float4 _Fluorescence; + float4 _Absorbance; + float _ScanlineSpeed; + float _ScanlineCount; + float _ScanlineIntensity; + float _EmissionFalloff; + float _Metallic; + float _Glossiness; + float _CoatSmoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + float3 _LightDirection; + float3 _LightPosition; + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + float3 normalWS = TransformObjectToWorldDir(v.ase_normal); + + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + float2 vShadowOffsets = GetShadowOffsets( normalWS, lightDirectionWS ); + positionWS.xyz += vShadowOffsets.y * lightDirectionWS.xyz / 1000; + float4 clipPos = TransformObjectToHClip( float4( mul( unity_WorldToObject, float4( positionWS.xyz, 1.0 ) ).xyz, 1.0 ) ); + //float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + #if UNITY_REVERSED_Z + clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #else + clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #endif + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = clipPos; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _ALPHATEST_ON + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + return 0; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _CLEARCOAT 1 + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _Pixels_TexelSize; + float4 _Pixels_ST; + float4 _EmissionColor; + float4 _Fluorescence; + float4 _Absorbance; + float _ScanlineSpeed; + float _ScanlineCount; + float _ScanlineIntensity; + float _EmissionFalloff; + float _Metallic; + float _Glossiness; + float _CoatSmoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + + Pass + { + + Name "Meta" + Tags { "LightMode"="Meta" } + + Cull Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _CLEARCOAT 1 + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature _ EDITOR_VISUALIZATION + + #define SHADERPASS SHADERPASS_META + + #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/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef EDITOR_VISUALIZATION + float4 VizUV : TEXCOORD2; + float4 LightCoord : TEXCOORD3; + #endif + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _Pixels_TexelSize; + float4 _Pixels_ST; + float4 _EmissionColor; + float4 _Fluorescence; + float4 _Absorbance; + float _ScanlineSpeed; + float _ScanlineCount; + float _ScanlineIntensity; + float _EmissionFalloff; + float _Metallic; + float _Glossiness; + float _CoatSmoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord4.xy = v.texcoord0.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.clipPos = MetaVertexPosition( v.vertex, v.texcoord1.xy, v.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); + + #ifdef EDITOR_VISUALIZATION + float2 VizUV = 0; + float4 LightCoord = 0; + UnityEditorVizData(v.vertex.xyz, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, VizUV, LightCoord); + o.VizUV = float4(VizUV, 0, 0); + o.LightCoord = LightCoord; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = o.clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 uv_MainTex = IN.ase_texcoord4.xy * _MainTex_ST.xy + _MainTex_ST.zw; + float4 temp_output_7_0 = ( SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, uv_MainTex ) * _Color ); + + + float3 Albedo = temp_output_7_0.rgb; + float3 Emission = 0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = Albedo; + metaInput.Emission = Emission; + #ifdef EDITOR_VISUALIZATION + metaInput.VizUV = IN.VizUV.xy; + metaInput.LightCoord = IN.LightCoord; + #endif + + return MetaFragment(metaInput); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "BakedRaytrace" + Tags{ "LightMode" = "BakedRaytrace" } + HLSLPROGRAM + + /*ase_pragma_before*/ + + #define SHADERPASS SHADERPASS_RAYTRACE + + #include "UnityRaytracingMeshUtils.cginc" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #define _EMISSION + #pragma raytracing test + #pragma shader_feature_local __ _ALBEDOMULTIPLY_ON + #pragma shader_feature_local __ _EMISSION_ON + + /*ase_pragma*/ + + struct RayPayload + { + float4 color; + float3 dir; + }; + + struct AttributeData + { + float2 barycentrics; + }; + + struct Vertex + { + float2 texcoord; + float3 normal; + }; + + Texture2D _BaseMap; + SamplerState sampler_BaseMap; + + CBUFFER_START( UnityPerMaterial ) + /*ase_srp_batcher*/ + Texture2D _EmissionMap; + SamplerState sampler_EmissionMap; + + float4 _EmissionColor; + float4 _BaseMap_ST; + float _BakedMutiplier = 1; + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + //https://coty.tips/raytracing-in-unity/ + [shader("closesthit")] + void MyClosestHit(inout RayPayload payload, + AttributeData attributes : SV_IntersectionAttributes) { + + payload.color = float4(0,0,0,1); //Intializing + payload.dir = float3(1,0,0); + + // #if _EMISSION_ON + uint2 launchIdx = DispatchRaysIndex(); + // ShadingData shade = getShadingData( PrimitiveIndex(), attribs ); + + uint primitiveIndex = PrimitiveIndex(); + uint3 triangleIndicies = UnityRayTracingFetchTriangleIndices(primitiveIndex); + Vertex v0, v1, v2; + + v0.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.x, kVertexAttributeTexCoord0); + v1.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.y, kVertexAttributeTexCoord0); + v2.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.z, kVertexAttributeTexCoord0); + + // v0.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.x, kVertexAttributeNormal); + // v1.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.y, kVertexAttributeNormal); + // v2.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.z, kVertexAttributeNormal); + + float3 barycentrics = float3(1.0 - attributes.barycentrics.x - attributes.barycentrics.y, attributes.barycentrics.x, attributes.barycentrics.y); + + Vertex vInterpolated; + vInterpolated.texcoord = v0.texcoord * barycentrics.x + v1.texcoord * barycentrics.y + v2.texcoord * barycentrics.z; + //TODO: Extract normal direction to ignore the backside of emissive objects + //vInterpolated.normal = v0.normal * barycentrics.x + v1.normal * barycentrics.y + v2.normal * barycentrics.z; + // if ( dot(vInterpolated.normal, float3(1,0,0) < 0) ) payload.color = float4(0,10,0,1) ; + // else payload.color = float4(10,0,0,1) ; + + //TODO: Figure out how to tie Amplify into using Texture2d and SamplerState instead of the bundled sampler2D. Forcing names for now. + //#if _ALBEDOMULTIPLY_ON + float4 albedo = float4(_BaseMap.SampleLevel(sampler_BaseMap, vInterpolated.texcoord.xy * _BaseMap_ST.xy + _BaseMap_ST.zw, 0 ).rgb , 1) ; + // #else + // float4 albedo = float4(1,1,1,1); + // #endif + + payload.color = float4( (_EmissionMap.SampleLevel(sampler_EmissionMap, vInterpolated.texcoord * _BaseMap_ST.xy + _BaseMap_ST.zw,0) ).rgb * _EmissionColor.rgb * albedo.rgb * _BakedMutiplier , 1 ); + // #else + // payload.color = float4(0,0,0,1); + + // #endif + } + ENDHLSL + + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend One Zero, One Zero + ColorMask RGBA + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _CLEARCOAT 1 + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_2D + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_texcoord2 : TEXCOORD2; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _Pixels_TexelSize; + float4 _Pixels_ST; + float4 _EmissionColor; + float4 _Fluorescence; + float4 _Absorbance; + float _ScanlineSpeed; + float _ScanlineCount; + float _ScanlineIntensity; + float _EmissionFalloff; + float _Metallic; + float _Glossiness; + float _CoatSmoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID( v ); + UNITY_TRANSFER_INSTANCE_ID( v, o ); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + o.ase_texcoord2.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord2.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 uv_MainTex = IN.ase_texcoord2.xy * _MainTex_ST.xy + _MainTex_ST.zw; + float4 temp_output_7_0 = ( SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, uv_MainTex ) * _Color ); + + + float3 Albedo = temp_output_7_0.rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + half4 color = half4( Albedo, Alpha ); + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + return color; + } + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormalsOnly" } + + ZWrite On + Blend One Zero + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _CLEARCOAT 1 + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/Color.hlsl" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _Pixels_TexelSize; + float4 _Pixels_ST; + float4 _EmissionColor; + float4 _Fluorescence; + float4 _Absorbance; + float _ScanlineSpeed; + float _ScanlineCount; + float _ScanlineIntensity; + float _EmissionFalloff; + float _Metallic; + float _Glossiness; + float _CoatSmoothness; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal( v.ase_normal ); + float4 tangentWS = float4(TransformObjectToWorldDir( v.ase_tangent.xyz), v.ase_tangent.w); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + float3 WorldNormal = IN.worldNormal; + float4 WorldTangent = IN.worldTangent; + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float3 Normal = float3(0, 0, 1); + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + return half4(packedNormalWS, 0.0); + #else + + #if defined(_NORMALMAP) + #if _NORMAL_DROPOFF_TS + float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz); + float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz)); + #elif _NORMAL_DROPOFF_OS + float3 normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + float3 normalWS = Normal; + #endif + #else + float3 normalWS = WorldNormal; + #endif + + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + #endif + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "GBuffer" + Tags{"LightMode" = "None" } + + Blend One Zero + ColorMask RGBA + /*ase_stencil*/ + + HLSLPROGRAM +/*ase_pragma_before*/ +#if FALSE + #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_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 _ _MIXED_LIGHTING_SUBTRACTIVE + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _GBUFFER_NORMALS_OCT + //#pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile _ _RENDER_PASS_ENABLED + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_GBUFFER + + #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/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + /*ase_pragma*/ + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;t=t;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + /*ase_interp(8,):sp=sp;sc=tc2;wn.xyz=tc3.xyz;wt.xyz=tc4.xyz;wbt.xyz=tc5.xyz;wp.x=tc3.w;wp.y=tc4.w;wp.z=tc5.w;spu=tc6*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + /*ase_srp_batcher*/ + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + /*ase_globals*/ + + /*ase_funcs*/ + + VertexOutput VertexFunction( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;8;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = /*ase_vert_out:Vertex Normal;Float3;10;-1;_Normal*/v.ase_normal/*end*/; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + /*ase_control_code:v=VertexInput;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;o=VertexInput;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + FragmentOutput frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + /*ase_frag_input*/ ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #else + ShadowCoords = float4(0, 0, 0, 0); + #endif + + + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + /*ase_frag_code:IN=VertexOutput*/ + float3 Albedo = /*ase_frag_out:Albedo;Float3;0;-1;_Albedo*/float3(0.5, 0.5, 0.5)/*end*/; + float3 Normal = /*ase_frag_out:Normal;Float3;1;-1;_FragNormal*/float3(0, 0, 1)/*end*/; + float3 Emission = /*ase_frag_out:Emission;Float3;2;-1;_Emission*/0/*end*/; + float3 Specular = /*ase_frag_out:Specular;Float3;9;-1;_Specular*/0.5/*end*/; + float Metallic = /*ase_frag_out:Metallic;Float;3;-1;_Metallic*/0/*end*/; + float Smoothness = /*ase_frag_out:Smoothness;Float;4;-1;_Smoothness*/0.5/*end*/; + float Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;6;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;7;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;16;-1;_AlphaClipShadow*/0.5/*end*/; + float3 BakedGI = /*ase_frag_out:Baked GI;Float3;11;-1;_BakedGI*/0/*end*/; + float3 RefractionColor = /*ase_frag_out:Refraction Color;Float3;12;-1;_RefractionColor*/1/*end*/; + float RefractionIndex = /*ase_frag_out:Refraction Index;Float;13;-1;_RefractionIndex*/1/*end*/; + float3 Transmission = /*ase_frag_out:Transmission;Float3;14;-1;_Transmission*/1/*end*/; + float3 Translucency = /*ase_frag_out:Translucency;Float3;15;-1;_Translucency*/1/*end*/; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/0/*end*/; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = IN.clipPos; + inputData.shadowCoord = ShadowCoords; + + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + #else + inputData.normalWS = WorldNormal; + #endif + + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + inputData.viewDirectionWS = SafeNormalize( WorldViewDirection ); + + + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(WorldPosition, 1.0), IN.fogFactorAndVertexLight.x); + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.clipPos, + Albedo, + Specular, + inputData.normalWS, + Metallic, + Occlusion, + Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData + (Albedo, Metallic, Specular, Smoothness, Alpha, brdfData); + + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + half4 color; + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + color.a = Alpha; + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _CLEARCOAT 1 + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _Pixels_TexelSize; + float4 _Pixels_ST; + float4 _EmissionColor; + float4 _Fluorescence; + float4 _Absorbance; + float _ScanlineSpeed; + float _ScanlineCount; + float _ScanlineIntensity; + float _EmissionFalloff; + float _Metallic; + float _Glossiness; + float _CoatSmoothness; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _FLUORESCENCE 1 + #define _CLEARCOAT 1 + #define _EMISSION + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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" + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_ST; + float4 _Color; + float4 _Pixels_TexelSize; + float4 _Pixels_ST; + float4 _EmissionColor; + float4 _Fluorescence; + float4 _Absorbance; + float _ScanlineSpeed; + float _ScanlineCount; + float _ScanlineIntensity; + float _EmissionFalloff; + float _Metallic; + float _Glossiness; + float _CoatSmoothness; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphLitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +2103;205;1980;1007;98.6217;593.2677;1;True;True +Node;AmplifyShaderEditor.SimpleTimeNode;28;-1963.34,166.5412;Inherit;True;1;0;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;52;-1703.675,-305.0131;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.LerpOp;32;-593.2473,506.1884;Inherit;False;3;0;FLOAT;1;False;1;FLOAT;1;False;2;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;48;-1606.187,161.5722;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RoundOpNode;55;-1460.675,-306.0131;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;37;-1208.74,766.7116;Inherit;True;Property;_Pixels;Pixels;11;0;Create;True;0;0;0;False;0;False;-1;None;81cc8fbe3bd52d149b2b91936b92bfb8;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;42;-876.7444,939.3727;Float;False;Constant;_Float0;Float 0;13;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;31;-2014.177,302.619;Float;False;Property;_ScanlineSpeed;Scanline Speed;8;0;Create;True;0;0;0;False;0;False;0.1;1;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;30;-1461.066,363.6114;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;38;-2194.587,-120.0314;Inherit;False;0;37;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;46;-1252.587,186.9722;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;23;-1786.443,775.0053;Inherit;True;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.DistanceOpNode;26;-869.1917,504.3452;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;29;-1332.832,513.4062;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.DynamicAppendNode;51;-1081.675,-50.01314;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.RangedFloatNode;34;-1361.512,659.3875;Float;False;Property;_ScanlineCount;Scanline Count;10;0;Create;True;0;0;0;False;0;False;32;3;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.RoundOpNode;49;-1430.675,148.9869;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;35;-1499.84,-96.83577;Inherit;False;0;4;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;12;-196,92;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.RangedFloatNode;74;386.5176,288.4572;Inherit;False;Property;_CoatSmoothness;Coat Smoothness;14;0;Create;True;0;0;0;False;0;False;0;1;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;25;-1048.214,501.6933;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;43;-1244.988,-10.22783;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;24;-1191.586,501.8281;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;5;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;75;584.5176,187.4572;Inherit;False;Constant;_Float1;Float 1;15;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;50;-1746.675,168.9869;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;10;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TexelSizeNode;53;-2117.675,-349.0131;Inherit;False;37;1;0;SAMPLER2D;_Sampler053;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleDivideOpNode;44;-1724.488,-65.9278;Inherit;True;2;0;FLOAT;0.2;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;54;-1832.675,-304.0131;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;6;-587,285;Float;False;Property;_EmissionColor;Emission Color;3;1;[HDR];Create;True;0;0;0;False;0;False;0,0,0,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-279,-45;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-331,204;Inherit;True;4;4;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;3;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.FractNode;45;-1212.287,308.4723;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;5;-586,67;Float;False;Property;_Color;Color;2;0;Create;True;0;0;0;False;0;False;1,1,1,1;0.1894357,0.3113207,0.3329999,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;41;-706.7444,867.3727;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;13;271,164;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.ColorNode;56;519.4634,393.2017;Float;False;Property;_Fluorescence;Fluorescence;12;0;Create;True;0;0;0;False;0;False;0.4083748,0.5377358,0.4464222,1;0.2499554,0.3867924,0.2920591,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;47;-1814.187,550.2723;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;33;-913.2633,762.6552;Float;False;Property;_ScanlineIntensity;Scanline Intensity;9;0;Create;True;0;0;0;False;0;False;0.5;0.124;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;3;-924.6398,177.2817;Inherit;True;Property;_EmissionMap;Emission Map;0;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;-1;None;3f0c59aec3c6e74448770f9846152333;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.AbsOpNode;19;75.29994,587.6;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;4;-919.6398,-44.71831;Inherit;True;Property;_MainTex;MainTex;1;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.ViewDirInputsCoordNode;15;-389.0001,690.2;Float;False;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.PowerNode;18;84.89996,662.5002;Inherit;False;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ToggleSwitchNode;11;-7,130;Float;False;Property;S_EMISSIVE_MULTI;Emissive Multiplication;6;0;Create;False;0;0;0;False;0;False;0;True;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.RangedFloatNode;20;-196.6515,739.8146;Float;False;Property;_EmissionFalloff;Emission Falloff;7;0;Create;True;0;0;0;False;0;False;1;0.88;0;5;0;1;FLOAT;0 +Node;AmplifyShaderEditor.ClampOpNode;22;244.7485,581.1144;Inherit;True;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;9;425,-124;Float;False;Property;_Glossiness;Glossiness;4;0;Create;True;0;0;0;False;0;False;1;0.04;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;10;425,-50;Float;False;Property;_Metallic;Metallic;5;0;Create;True;0;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;21;79.84846,764.2144;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;57;544.4634,556.2017;Float;False;Property;_Absorbance;Absorbance;13;0;Create;True;0;0;0;False;0;False;0.042,0.112,0.517,1;0.04199992,0.4259999,0.837,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.DotProductOpNode;16;-169.6,525.7999;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WorldNormalVector;14;-385.5001,555.4998;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;69;774,-61;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;71;774,-61;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;72;774,-61;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;73;774,-61;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;64;774,-61;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;65;774,-61;Half;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;SLZ/Scanline;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;23;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalForwardOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;47;Workflow;1;0;Surface;0;0; Refraction Model;0;0; Blend;0;0;Two Sided;1;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Transmission;0;0; Transmission Shadow;0.5,False,-1;0;Translucency;0;0; Translucency Strength;1,False,-1;0; Normal Distortion;0.5,False,-1;0; Scattering;2,False,-1;0; Direct;0.9,False,-1;0; Ambient;0.1,False,-1;0; Shadow;0.5,False,-1;0;Cast Shadows;1;0; Use Shadow Threshold;0;0;Receive Shadows;1;0;GPU Instancing;1;0;LOD CrossFade;0;637836073346625293;Built-in Fog;1;0;Lightmaps;1;0;Volumetrics;1;0;Decals;0;637892668756952080;Screen Space Occlusion;1;0;Light Layers;0;637892668835458876;_FinalColorxAlpha;0;0;Meta Pass;1;0;GBuffer Pass;0;0;Override Baked GI;0;0;Extra Pre Pass;0;0;DOTS Instancing;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Write Depth;0;0; Early Z;0;0;Vertex Position,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;1;637892669717331784;Fluorescence;1;637892668684714568;0;10;False;True;True;True;True;True;True;False;True;True;False;;True;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;66;774,-61;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;67;774,-61;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;68;774,-61;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;70;774,-61;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormalsOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +WireConnection;52;0;54;0 +WireConnection;32;1;26;0 +WireConnection;32;2;33;0 +WireConnection;48;0;50;0 +WireConnection;55;0;52;0 +WireConnection;30;0;47;0 +WireConnection;46;0;44;0 +WireConnection;46;1;49;0 +WireConnection;46;2;55;0 +WireConnection;26;0;25;0 +WireConnection;29;0;23;2 +WireConnection;29;1;30;0 +WireConnection;51;0;35;1 +WireConnection;51;1;43;0 +WireConnection;49;0;48;0 +WireConnection;12;0;7;0 +WireConnection;12;1;8;0 +WireConnection;25;0;24;0 +WireConnection;43;0;35;2 +WireConnection;43;1;46;0 +WireConnection;24;0;29;0 +WireConnection;24;1;34;0 +WireConnection;50;0;28;0 +WireConnection;44;1;53;4 +WireConnection;54;0;38;2 +WireConnection;7;0;4;0 +WireConnection;7;1;5;0 +WireConnection;8;0;3;0 +WireConnection;8;1;6;0 +WireConnection;8;2;32;0 +WireConnection;8;3;41;0 +WireConnection;41;0;37;0 +WireConnection;41;1;42;0 +WireConnection;13;0;8;0 +WireConnection;13;1;22;0 +WireConnection;47;0;28;0 +WireConnection;47;1;31;0 +WireConnection;3;1;51;0 +WireConnection;19;0;16;0 +WireConnection;4;1;35;0 +WireConnection;18;0;19;0 +WireConnection;18;1;21;0 +WireConnection;11;0;8;0 +WireConnection;11;1;12;0 +WireConnection;22;0;18;0 +WireConnection;21;0;20;0 +WireConnection;16;0;14;0 +WireConnection;16;1;15;0 +WireConnection;65;0;7;0 +WireConnection;65;2;13;0 +WireConnection;65;3;10;0 +WireConnection;65;4;9;0 +WireConnection;65;18;75;0 +WireConnection;65;19;74;0 +WireConnection;65;21;56;0 +WireConnection;65;22;57;0 +ASEEND*/ +//CHKSM=A61871AC4C1B0DB16147C28EFAC8E31AD93C90EC \ No newline at end of file diff --git a/Assets/SLZShaders/Scanline.shader.meta b/Assets/SLZShaders/Scanline.shader.meta new file mode 100644 index 0000000..6535007 --- /dev/null +++ b/Assets/SLZShaders/Scanline.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ae467daa42d17ee45b6947a14ec8ec96 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/SimpleSkybox.shader b/Assets/SLZShaders/SimpleSkybox.shader new file mode 100644 index 0000000..34ed14f --- /dev/null +++ b/Assets/SLZShaders/SimpleSkybox.shader @@ -0,0 +1,1786 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/Simple Geo Skybox" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) + [ASEEnd][ASEBegin][HDR][NoScaleOffset]_BaseMap("BaseMap", CUBE) = "white" {} + + [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) = "" {} + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" } + + Cull Back + AlphaToMask Off + + HLSLINCLUDE + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma target 5.0 + + //#pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForwardOnly" } + + Blend One Zero, One Zero + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_SRP_VERSION 999999 + + + //#pragma multi_compile _ LIGHTMAP_ON + //#pragma multi_compile _ DIRLIGHTMAP_COMBINED + //#pragma shader_feature _ _SAMPLE_GI + //#pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + //#pragma multi_compile _ DEBUG_DISPLAY + #define SHADERPASS SHADERPASS_UNLIT + + + #pragma vertex vert + #pragma fragment frag + + #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/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl" + + + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef ASE_FOG + float fogFactor : TEXCOORD2; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + samplerCUBE _BaseMap; + + + + VertexOutput VertexFunction ( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + #ifdef ASE_FOG + o.fogFactor = ComputeFogFactor( positionCS.z ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag ( VertexOutput IN ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - WorldPosition ); + ase_worldViewDir = normalize(ase_worldViewDir); + half4 texCUBENode5 = texCUBElod( _BaseMap, float4( -ase_worldViewDir, 0.0) ); + + half3 BakedAlbedo = 0; + half3 BakedEmission = 0; + half3 Color = texCUBENode5.rgb; + half Alpha = 1; + half AlphaClipThreshold = 0.5; + half AlphaClipThresholdShadow = 0.5; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #if defined(_DBUFFER) + ApplyDecalToBaseColor(IN.clipPos, Color); + #endif + + #if defined(_ALPHAPREMULTIPLY_ON) + Color *= Alpha; + #endif + + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + + #ifdef ASE_FOG + //Color = MixFog( Color, IN.fogFactor ); + half3 viewDirectionWS = normalize(IN.worldPos - _WorldSpaceCameraPos); + Color.rgb = MixFog(Color.rgb, viewDirectionWS, IN.fogFactor); + #endif + half4 output = half4(Color, Alpha); + #ifdef _VOLUMETRICS_ENABLED + output = Volumetrics(output, IN.worldPos); + #endif + + return output; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #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/Color.hlsl" + + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.clipPos = TransformWorldToHClip( positionWS ); + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = o.clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + return 0; + } + ENDHLSL + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend One Zero, One Zero + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + + + HLSLPROGRAM +#pragma multi_compile_instancing#define _RECEIVE_SHADOWS_OFF 1#pragma multi_compile_fog#define ASE_FOG 1#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED#define ASE_SRP_VERSION 999999 +#if FALSE + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma shader_feature _ _SAMPLE_GI + #pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ DEBUG_DISPLAY + #define SHADERPASS SHADERPASS_UNLIT + + + #pragma vertex vert + #pragma fragment frag + + #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/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl" + + + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef ASE_FOG + float fogFactor : TEXCOORD2; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + samplerCUBE _BaseMap; + + + + VertexOutput VertexFunction ( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + #ifdef ASE_FOG + o.fogFactor = ComputeFogFactor( positionCS.z ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag ( VertexOutput IN ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + float3 ase_worldViewDir = ( _WorldSpaceCameraPos.xyz - WorldPosition ); + ase_worldViewDir = normalize(ase_worldViewDir); + half4 texCUBENode5 = texCUBElod( _BaseMap, float4( -ase_worldViewDir, 0.0) ); + + float3 BakedAlbedo = 0; + float3 BakedEmission = 0; + float3 Color = texCUBENode5.rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #if defined(_DBUFFER) + ApplyDecalToBaseColor(IN.clipPos, Color); + #endif + + #if defined(_ALPHAPREMULTIPLY_ON) + Color *= Alpha; + #endif + + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_FOG + Color = MixFog( Color, IN.fogFactor ); + #endif + + return half4( Color, Alpha ); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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" + + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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" + + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormalsOnly" } + + ZTest LEqual + ZWrite On + + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + //#pragma multi_compile_fog + #pragma instancing_options renderinglayer + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define VARYINGS_NEED_NORMAL_WS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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" + + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float3 normalWS : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal(v.ase_normal); + + o.clipPos = TransformWorldToHClip(positionWS); + o.normalWS.xyz = normalWS; + + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + #if _ALPHATEST_ON + clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + float3 normalWS = IN.normalWS; + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + + } + + ENDHLSL + } + + + Pass + { + + Name "DepthNormalsOnly" + Tags { "LightMode"="DepthNormalsOnly" } + + ZTest LEqual + ZWrite On + + + HLSLPROGRAM + + #pragma multi_compile_instancing + #define _RECEIVE_SHADOWS_OFF 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #define ASE_NEEDS_FRAG_WORLD_POSITION + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_SRP_VERSION 999999 + + + #pragma exclude_renderers glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD1 + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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" + + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float3 normalWS : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal(v.ase_normal); + + o.clipPos = TransformWorldToHClip(positionWS); + o.normalWS.xyz = normalWS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + #if _ALPHATEST_ON + clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + float3 normalWS = IN.normalWS; + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphUnlitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +2678;198;1538;978;933.8952;716.6381;1.807404;True;True +Node;AmplifyShaderEditor.ViewDirInputsCoordNode;6;-971.2615,-126.0529;Inherit;False;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.RangedFloatNode;13;-595.4363,49.93512;Inherit;False;Constant;_Float0;Float 0;1;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorSpaceDouble;10;-441.8362,157.5351;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.WorldPosInputsNode;26;-70.63371,71.13003;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.FunctionNode;44;205.1276,65.41274;Inherit;False;VolumetricsUnlit;-1;;1;800698b1441791d449f3e84fa3283d1e;0;2;2;FLOAT4;0,0,0,0;False;3;FLOAT3;0,0,0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.NegateNode;7;-691.2615,-99.05289;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.SamplerNode;5;-436.2615,-88.05289;Inherit;True;Property;_BaseMap;BaseMap;0;2;[HDR];[NoScaleOffset];Create;True;0;0;0;False;0;False;-1;None;115f13f0a868a454e9cdcee7cf7dba60;True;0;False;white;LockedToCube;False;Object;-1;MipLevel;Cube;8;0;SAMPLERCUBE;;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;43;405.1046,-78.74908;Inherit;False;Constant;_Float1;Float 1;1;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;11;-211.4362,152.4351;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;54;587.1003,-38.3;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthNormalsOnly;0;9;DepthNormalsOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormalsOnly;False;True;15;d3d9;d3d11_9x;d3d11;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;46;779.1003,-51.3;Half;False;True;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;3;SLZ/Simple Geo Skybox;2992e84f91cbeb14eab234972e07ea9d;True;Forward;0;1;Forward;8;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;True;1;False;-1;True;3;False;-1;True;False;0;False;-1;0;False;-1;True;1;LightMode=UniversalForwardOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;23;Surface;0;0; Blend;0;0;Two Sided;1;0;Cast Shadows;0;637807401842264069; Use Shadow Threshold;0;0;Receive Shadows;0;637807401834704909;GPU Instancing;1;0;LOD CrossFade;0;0;Built-in Fog;1;637993323652933281;Volumetrics;1;638005268622411681;DOTS Instancing;0;0;Meta Pass;0;0;Extra Pre Pass;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Vertex Position,InvertActionOnDeselection;1;0;0;10;False;True;False;True;False;True;True;True;True;True;False;;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;50;587.1003,-38.3;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;False;0;False;-1;0;False;-1;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;52;587.1003,-38.3;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ScenePickingPass;0;7;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;48;587.1003,-38.3;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;47;587.1003,-38.3;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;53;587.1003,-38.3;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthNormals;0;8;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormalsOnly;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;49;587.1003,-38.3;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;45;587.1003,-38.3;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;51;587.1003,-38.3;Float;False;False;-1;2;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;SceneSelectionPass;0;6;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;7;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +WireConnection;44;2;5;0 +WireConnection;44;3;26;0 +WireConnection;7;0;6;0 +WireConnection;5;1;7;0 +WireConnection;5;2;13;0 +WireConnection;11;0;5;0 +WireConnection;11;1;10;0 +WireConnection;46;2;5;0 +ASEEND*/ +//CHKSM=FE0C017DDD4CAF33D48E7830284AFEDD48DFDB24 \ No newline at end of file diff --git a/Assets/SLZShaders/SimpleSkybox.shader.meta b/Assets/SLZShaders/SimpleSkybox.shader.meta new file mode 100644 index 0000000..e7fd647 --- /dev/null +++ b/Assets/SLZShaders/SimpleSkybox.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7276a03ae0651b1419b50e2c76272732 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/TMP_SDF-URP Lit Baked.shader b/Assets/SLZShaders/TMP_SDF-URP Lit Baked.shader new file mode 100644 index 0000000..e15eb19 --- /dev/null +++ b/Assets/SLZShaders/TMP_SDF-URP Lit Baked.shader @@ -0,0 +1,4027 @@ +Shader "Baked Shadergraphs/TMP_SDF-URP Lit" +{ + Properties + { + [NoScaleOffset]_MainTex("_MainTex", 2D) = "white" {} + _OutlineOffset1("_OutlineOffset1", Vector) = (0, 0, 0, 0) + _OutlineOffset2("_OutlineOffset2", Vector) = (0, 0, 0, 0) + _OutlineOffset3("_OutlineOffset3", Vector) = (0, 0, 0, 0) + _GradientScale("_GradientScale", Float) = 10 + [HDR]_FaceColor("_FaceColor", Color) = (1, 1, 1, 1) + _IsoPerimeter("Outline Width", Vector) = (0, 0, 0, 0) + [HDR]_OutlineColor1("_OutlineColor1", Color) = (0, 1, 0.9600265, 1) + [HDR]_OutlineColor2("_OutlineColor2", Color) = (0, 0.06557035, 1, 1) + [HDR]_OutlineColor3("_OutlineColor3", Color) = (0, 0, 0, 0) + [ToggleUI]_OutlineMode("_OutlineMode", Float) = 0 + _Softness("_Softness", Vector) = (0, 0, 0, 0) + [NoScaleOffset]_FaceTex("_FaceTex", 2D) = "white" {} + _FaceUVSpeed("_FaceUVSpeed", Vector) = (0, 0, 0, 0) + _FaceTex_ST("_FaceTex_ST", Vector) = (2, 2, 0, 0) + _OutlineTex_ST("_OutlineTex_ST", Vector) = (1, 1, 0, 0) + _OutlineUVSpeed("_OutlineUVSpeed", Vector) = (0, 0, 0, 0) + _UnderlayColor("_UnderlayColor", Color) = (0, 0, 0, 1) + _UnderlayOffset("_UnderlayOffset", Vector) = (0, 0, 0, 0) + _UnderlayDilate("_UnderlayDilate", Float) = 0 + _UnderlaySoftness("_UnderlaySoftness", Float) = 0 + [ToggleUI]_BevelType("_BevelType", Float) = 0 + _BevelAmount("_BevelAmount", Range(0, 1)) = 0 + _BevelOffset("_BevelOffset", Range(-0.5, 0.5)) = 0 + _BevelWidth("_BevelWidth", Range(0, 0.5)) = 0.5 + _BevelRoundness("_BevelRoundness", Range(0, 1)) = 0 + _BevelClamp("_BevelClamp", Range(0, 1)) = 0 + [HDR]_SpecularColor("Light color", Color) = (1, 1, 1, 1) + _LightAngle("_LightAngle", Range(0, 6.28)) = 0 + _SpecularPower("_SpecularPower", Range(0, 4)) = 0 + _Reflectivity("Reflectivity Power", Range(5, 15)) = 5 + _Diffuse("Diffuse Shadow", Range(0, 1)) = 0.3 + _Ambient("Ambient Shadow", Range(0, 1)) = 0.3 + [NoScaleOffset]_OutlineTex("_OutlineTex", 2D) = "white" {} + _ScaleRatioA("_ScaleRatioA", Float) = 0 + Emissive("Emissive", Color) = (0, 0, 0, 0) + _smoothness("Smoothness", Range(0, 1)) = 0.5 + _Metalic("Metalic", Range(0, 1)) = 0 + [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" + "UniversalMaterialType" = "Lit" + "Queue"="Transparent" + "ShaderGraphShader"="true" + "ShaderGraphTargetId"="UniversalLitSubTarget" + } + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + + // Render State + Cull Off + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + + // Debug + // + + // -------------------------------------------------- + // Pass + + HLSLPROGRAM + + // Pragmas + #pragma target 4.5 + #pragma exclude_renderers gles gles3 glcore + #pragma multi_compile_instancing + #pragma multi_compile_fog + //#pragma instancing_options renderinglayer + //#pragma multi_compile _ DOTS_INSTANCING_ON + #pragma vertex vert + #pragma fragment frag + + // DotsInstancingOptions: + // HybridV1InjectedBuiltinProperties: + + // Keywords + //#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ _VOLUMETRICS_ENABLED + #define _DISABLE_LIGHTMAPS + #define _DISABLE_REFLECTIONPROBES + #define _DISABLE_SSAO + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.hlsl" + /* + #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: + + // Defines + + #define _NORMALMAP 1 + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define ATTRIBUTES_NEED_TEXCOORD3 + #define ATTRIBUTES_NEED_COLOR + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_TEXCOORD1 + #define VARYINGS_NEED_TEXCOORD2 + #define VARYINGS_NEED_TEXCOORD3 + #define VARYINGS_NEED_COLOR + #define VARYINGS_NEED_VIEWDIRECTION_WS + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define VARYINGS_NEED_SHADOW_COORD + #define VARYINGS_NEED_CULLFACE + #define FEATURES_GRAPH_VERTEX + /* WARNING: $splice Could not find named fragment 'PassInstancing' */ + #define SHADERPASS SHADERPASS_FORWARD + #define _FOG_FRAGMENT 1 + #define _SURFACE_TYPE_TRANSPARENT 1 + #define _ALPHATEST_ON 1 + /* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */ + + + // custom interpolator pre-include + /* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */ + + // 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" + + // -------------------------------------------------- + // Structs and Packing + + // custom interpolators pre packing + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */ + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + float4 uv3 : TEXCOORD3; + float4 color : COLOR; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : INSTANCEID_SEMANTIC; + #endif + }; + struct Varyings + { + float4 positionCS : SV_POSITION; + float3 positionWS; + float3 normalWS; + float4 tangentWS; + float4 texCoord0; + float4 texCoord1; + float4 texCoord2; + float4 texCoord3; + float4 color; + float3 viewDirectionWS; + #if defined(LIGHTMAP_ON) + float2 staticLightmapUV; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh; + #endif + float4 fogFactorAndVertexLight; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord; + #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 + }; + struct SurfaceDescriptionInputs + { + float3 TangentSpaceNormal; + float4 uv0; + float4 uv1; + float4 uv2; + float4 uv3; + float4 VertexColor; + float FaceSign; + }; + struct VertexDescriptionInputs + { + float3 ObjectSpaceNormal; + float3 ObjectSpaceTangent; + float3 ObjectSpacePosition; + }; + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float3 interp0 : INTERP0; + float3 interp1 : INTERP1; + float4 interp2 : INTERP2; + float4 interp3 : INTERP3; + float4 interp4 : INTERP4; + float4 interp5 : INTERP5; + float4 interp6 : INTERP6; + float4 interp7 : INTERP7; + float3 interp8 : INTERP8; + float2 interp9 : INTERP9; + float2 interp10 : INTERP10; + float3 interp11 : INTERP11; + float4 interp12 : INTERP12; + float4 interp13 : INTERP13; + #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 + }; + + PackedVaryings PackVaryings (Varyings input) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + output.positionCS = input.positionCS; + output.interp0.xyz = input.positionWS; + output.interp1.xyz = input.normalWS; + output.interp2.xyzw = input.tangentWS; + output.interp3.xyzw = input.texCoord0; + output.interp4.xyzw = input.texCoord1; + output.interp5.xyzw = input.texCoord2; + output.interp6.xyzw = input.texCoord3; + output.interp7.xyzw = input.color; + output.interp8.xyz = input.viewDirectionWS; + #if defined(LIGHTMAP_ON) + output.interp9.xy = input.staticLightmapUV; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + output.interp10.xy = input.dynamicLightmapUV; + #endif + #if !defined(LIGHTMAP_ON) + output.interp11.xyz = input.sh; + #endif + output.interp12.xyzw = input.fogFactorAndVertexLight; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + output.interp13.xyzw = input.shadowCoord; + #endif + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + Varyings UnpackVaryings (PackedVaryings input) + { + Varyings output; + output.positionCS = input.positionCS; + output.positionWS = input.interp0.xyz; + output.normalWS = input.interp1.xyz; + output.tangentWS = input.interp2.xyzw; + output.texCoord0 = input.interp3.xyzw; + output.texCoord1 = input.interp4.xyzw; + output.texCoord2 = input.interp5.xyzw; + output.texCoord3 = input.interp6.xyzw; + output.color = input.interp7.xyzw; + output.viewDirectionWS = input.interp8.xyz; + #if defined(LIGHTMAP_ON) + output.staticLightmapUV = input.interp9.xy; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + output.dynamicLightmapUV = input.interp10.xy; + #endif + #if !defined(LIGHTMAP_ON) + output.sh = input.interp11.xyz; + #endif + output.fogFactorAndVertexLight = input.interp12.xyzw; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + output.shadowCoord = input.interp13.xyzw; + #endif + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + + // -------------------------------------------------- + // Graph + + // Graph Properties + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_TexelSize; + float2 _OutlineOffset1; + float2 _OutlineOffset2; + float2 _OutlineOffset3; + float _GradientScale; + float4 _FaceColor; + float4 _IsoPerimeter; + float4 _OutlineColor1; + float4 _OutlineColor2; + float4 _OutlineColor3; + float _OutlineMode; + float3 _Softness; + float4 _FaceTex_TexelSize; + float2 _FaceUVSpeed; + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + float2 _OutlineUVSpeed; + float4 _UnderlayColor; + float2 _UnderlayOffset; + float _UnderlayDilate; + float _UnderlaySoftness; + float _BevelType; + float _BevelAmount; + float _BevelOffset; + float _BevelWidth; + float _BevelRoundness; + float _BevelClamp; + float4 _SpecularColor; + float _LightAngle; + float _SpecularPower; + float _Reflectivity; + float _Diffuse; + float _Ambient; + float4 _OutlineTex_TexelSize; + float _ScaleRatioA; + float4 Emissive; + float _smoothness; + float _Metalic; + CBUFFER_END + + // Object and Global properties + SAMPLER(SamplerState_Linear_Repeat); + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + TEXTURE2D(_FaceTex); + SAMPLER(sampler_FaceTex); + SAMPLER(SamplerState_Linear_Clamp); + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + + // Graph Includes + #include "Assets/TextMesh Pro/Shaders/SDFFunctions.hlsl" + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + // Graph Functions + + void Unity_Combine_float(float R, float G, float B, float A, out float4 RGBA, out float3 RGB, out float2 RG) + { + RGBA = float4(R, G, B, A); + RGB = float3(R, G, B); + RG = float2(R, G); + } + + void Unity_Divide_float4(float4 A, float4 B, out float4 Out) + { + Out = A / B; + } + + void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out) + { + Out = A * B; + } + + void Unity_Subtract_float2(float2 A, float2 B, out float2 Out) + { + Out = A - B; + } + + void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out) + { + Out = A * B; + } + + // Custom interpolators pre vertex + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */ + + // Graph Vertex + struct VertexDescription + { + float3 Position; + float3 Normal; + float3 Tangent; + }; + + VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN) + { + VertexDescription description = (VertexDescription)0; + description.Position = IN.ObjectSpacePosition; + description.Normal = IN.ObjectSpaceNormal; + description.Tangent = IN.ObjectSpaceTangent; + return description; + } + + // Custom interpolators, pre surface + #ifdef FEATURES_GRAPH_VERTEX + Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input) + { + return output; + } + #define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC + #endif + + // Graph Pixel + struct SurfaceDescription + { + float3 BaseColor; + float3 NormalTS; + float3 Emission; + float Metallic; + float Smoothness; + float Occlusion; + float Alpha; + float AlphaClipThreshold; + }; + + SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) + { + SurfaceDescription surface = (SurfaceDescription)0; + float4 _UV_533a59502f0abc8bb2c09828f32ebead_Out_0 = IN.uv0; + UnityTexture2D _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.z; + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Height_2 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.w; + float _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3; + ScreenSpaceRatio_float((_UV_533a59502f0abc8bb2c09828f32ebead_Out_0.xy), _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0, 0, _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3); + UnityTexture2D _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(IN.uv0.xy)); + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_R_4 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.r; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_G_5 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.g; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_B_6 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.b; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.a; + float4 _UV_b26868a97b712882abeca1b58698beb0_Out_0 = IN.uv0; + float2 _Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0 = _OutlineOffset1; + float _Property_c650c0154e947e898564d7d1d007d48e_Out_0 = _GradientScale; + UnityTexture2D _Property_6e377359c1349380b9482e9613fcec6b_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.z; + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.w; + float4 _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4; + float3 _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5; + float2 _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6; + Unity_Combine_float(_TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0, _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2, 0, 0, _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5, _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6); + float4 _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2; + Unity_Divide_float4((_Property_c650c0154e947e898564d7d1d007d48e_Out_0.xxxx), _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2); + float2 _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2; + Unity_Multiply_float2_float2(_Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2); + float2 _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2, _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2); + float4 _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_8ecda3d29d47068e8b76538959fab084_Out_2)); + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_R_4 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.r; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_G_5 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.g; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_B_6 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.b; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.a; + float2 _Property_5a3269796f550283a99abee895aeedd4_Out_0 = _OutlineOffset2; + float2 _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2; + Unity_Multiply_float2_float2((_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Property_5a3269796f550283a99abee895aeedd4_Out_0, _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2); + float2 _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2, _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2); + float4 _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2)); + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_R_4 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.r; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_G_5 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.g; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_B_6 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.b; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.a; + float2 _Property_20cbcbce438f6581847bd3da66673af8_Out_0 = _OutlineOffset3; + float2 _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2; + Unity_Multiply_float2_float2(_Property_20cbcbce438f6581847bd3da66673af8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2); + float2 _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2, _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2); + float4 _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2)); + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_R_4 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.r; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_G_5 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.g; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_B_6 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.b; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.a; + float4 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4; + float3 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5; + float2 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6; + Unity_Combine_float(_SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7, _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7, _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7, _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6); + float _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0 = _GradientScale; + float4 _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0 = _IsoPerimeter; + float3 _Property_05d545af6f7ff08387320e1130c67389_Out_0 = _Softness; + float _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0 = _OutlineMode; + float4 _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6; + ComputeSDF44_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0, _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0, (float4(_Property_05d545af6f7ff08387320e1130c67389_Out_0, 1.0)), _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0, _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6); + float4 _Property_eaed1eca838e7183ae708f9502a50dba_Out_0 = _FaceColor; + UnityTexture2D _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0 = UnityBuildTexture2DStructNoScale(_FaceTex); + float4 _UV_90e11fefcc71b18b8d88b417548d224f_Out_0 = IN.uv0; + float4 _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0 = _FaceTex_ST; + float2 _Property_ced4707a1339568eb002c789407f8a3b_Out_0 = _FaceUVSpeed; + float2 _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3; + GenerateUV_float((_UV_90e11fefcc71b18b8d88b417548d224f_Out_0.xy), _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0, _Property_ced4707a1339568eb002c789407f8a3b_Out_0, _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3); + float4 _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.tex, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.samplerstate, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.GetTransformedUV(_GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3)); + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_R_4 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.r; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_G_5 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.g; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_B_6 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.b; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_A_7 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.a; + float4 _Multiply_48133834a18f14828ac11b58bc205702_Out_2; + Unity_Multiply_float4_float4(_Property_eaed1eca838e7183ae708f9502a50dba_Out_0, _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0, _Multiply_48133834a18f14828ac11b58bc205702_Out_2); + float4 _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2; + Unity_Multiply_float4_float4(IN.VertexColor, _Multiply_48133834a18f14828ac11b58bc205702_Out_2, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2); + float4 _Property_4637336160f04f8397ca8f3b6531e88e_Out_0 = _OutlineColor1; + UnityTexture2D _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0 = UnityBuildTexture2DStructNoScale(_OutlineTex); + float4 _UV_343788cf38e6598db275321a22b05984_Out_0 = IN.uv0; + float4 _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0 = _OutlineTex_ST; + float2 _Property_11ca84fc4adc63868541229e4f404eae_Out_0 = _OutlineUVSpeed; + float2 _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3; + GenerateUV_float((_UV_343788cf38e6598db275321a22b05984_Out_0.xy), _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0, _Property_11ca84fc4adc63868541229e4f404eae_Out_0, _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3); + float4 _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.tex, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.samplerstate, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.GetTransformedUV(_GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3)); + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_R_4 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.r; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_G_5 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.g; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_B_6 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.b; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_A_7 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.a; + float4 _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2; + Unity_Multiply_float4_float4(_Property_4637336160f04f8397ca8f3b6531e88e_Out_0, _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2); + float4 _Property_6e8acbed3933c6819383cb89fe70a942_Out_0 = _OutlineColor2; + float2 _Property_baa8c75173022e86bde4cc075585af43_Out_0 = _OutlineOffset3; + float4 _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5; + Layer4_float(_ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2, _Property_6e8acbed3933c6819383cb89fe70a942_Out_0, (float4(_Property_baa8c75173022e86bde4cc075585af43_Out_0, 0.0, 1.0)), _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5); + UnityTexture2D _Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + UnityTexture2D _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_abc928409a963289955625c60e3c3674_Width_0 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.z; + float _TexelSize_abc928409a963289955625c60e3c3674_Height_2 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.w; + float4 _UV_7afe81a63629c789aece6cf7ed368769_Out_0 = IN.uv0; + float _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0 = max(0, IN.FaceSign.x); + float3 _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5; + GetSurfaceNormal_float(_Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0.tex, _TexelSize_abc928409a963289955625c60e3c3674_Width_0, _TexelSize_abc928409a963289955625c60e3c3674_Height_2, (_UV_7afe81a63629c789aece6cf7ed368769_Out_0).x, _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5); + float4 _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2; + EvaluateLight_float(_Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5, _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2); + UnityTexture2D _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _UV_87b50231796c43898a28be7b2f8daea3_Out_0 = IN.uv0; + float2 _Property_c20a130451687b8c87b5a623d8ca6d73_Out_0 = _UnderlayOffset; + float2 _Multiply_7d754a30a319c9839ca945e596548e63_Out_2; + Unity_Multiply_float2_float2(_Property_c20a130451687b8c87b5a623d8ca6d73_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2); + float2 _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2; + Unity_Subtract_float2((_UV_87b50231796c43898a28be7b2f8daea3_Out_0.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2, _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2); + float4 _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0 = SAMPLE_TEXTURE2D(_Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.tex, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.samplerstate, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.GetTransformedUV(_Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2)); + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_R_4 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.r; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_G_5 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.g; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_B_6 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.b; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_A_7 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.a; + float _Property_cb906f6db0fb388a91590590b04091ab_Out_0 = _GradientScale; + float _Property_22272afe5996178386aac669fbda451b_Out_0 = _UnderlayDilate; + float _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0 = _UnderlaySoftness; + float _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0; + ComputeSDF_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, (_SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0).x, _Property_cb906f6db0fb388a91590590b04091ab_Out_0, _Property_22272afe5996178386aac669fbda451b_Out_0, _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0, _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0); + float4 _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0 = _UnderlayColor; + float4 _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2; + Layer1_float(_ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0, _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2); + float4 _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2; + Composite_float(_EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2, _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2); + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_R_1 = IN.VertexColor[0]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_G_2 = IN.VertexColor[1]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_B_3 = IN.VertexColor[2]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4 = IN.VertexColor[3]; + float4 _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2; + Unity_Multiply_float4_float4(_CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2, (_Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4.xxxx), _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2); + float4 _Property_c74b31cf958e978797249554cd8dd6be_Out_0 = Emissive; + float4 _Multiply_e1a973f199b55389b5df6b0985db43a7_Out_2; + Unity_Multiply_float4_float4(_Property_c74b31cf958e978797249554cd8dd6be_Out_0, _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2, _Multiply_e1a973f199b55389b5df6b0985db43a7_Out_2); + float _Split_9b3e8141df129b848c4c1b364b613b86_R_1 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[0]; + float _Split_9b3e8141df129b848c4c1b364b613b86_G_2 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[1]; + float _Split_9b3e8141df129b848c4c1b364b613b86_B_3 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[2]; + float _Split_9b3e8141df129b848c4c1b364b613b86_A_4 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[3]; + float4 _Multiply_b32230c509acbc8f89fb8f34c19f9513_Out_2; + Unity_Multiply_float4_float4(_Multiply_e1a973f199b55389b5df6b0985db43a7_Out_2, (_Split_9b3e8141df129b848c4c1b364b613b86_A_4.xxxx), _Multiply_b32230c509acbc8f89fb8f34c19f9513_Out_2); + float _Property_c8a6020bb811b98d84a5e74d0bd3ee3b_Out_0 = _Metalic; + float _Property_7f5c7787a25f4c86a3ab8cfae98caa25_Out_0 = _smoothness; + surface.BaseColor = (_Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2.xyz); + surface.NormalTS = _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5; + surface.Emission = (_Multiply_b32230c509acbc8f89fb8f34c19f9513_Out_2.xyz); + surface.Metallic = _Property_c8a6020bb811b98d84a5e74d0bd3ee3b_Out_0; + surface.Smoothness = _Property_7f5c7787a25f4c86a3ab8cfae98caa25_Out_0; + surface.Occlusion = 1; + surface.Alpha = _Split_9b3e8141df129b848c4c1b364b613b86_A_4; + surface.AlphaClipThreshold = 0.5; + return surface; + } + + // -------------------------------------------------- + // Build Graph Inputs + #ifdef HAVE_VFX_MODIFICATION + #define VFX_SRP_ATTRIBUTES Attributes + #define VFX_SRP_VARYINGS Varyings + #define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs + #endif + VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input) + { + VertexDescriptionInputs output; + ZERO_INITIALIZE(VertexDescriptionInputs, output); + + output.ObjectSpaceNormal = input.normalOS; + output.ObjectSpaceTangent = input.tangentOS.xyz; + output.ObjectSpacePosition = input.positionOS; + + return output; + } + SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) + { + SurfaceDescriptionInputs output; + ZERO_INITIALIZE(SurfaceDescriptionInputs, output); + + #ifdef HAVE_VFX_MODIFICATION + // FragInputs from VFX come from two places: Interpolator or CBuffer. + /* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */ + + #endif + + + + + + output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f); + + + output.uv0 = input.texCoord0; + output.uv1 = input.texCoord1; + output.uv2 = input.texCoord2; + output.uv3 = input.texCoord3; + output.VertexColor = input.color; + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false); + #else + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #endif + BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + + return output; + } + + // -------------------------------------------------- + // Main + + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/PBRForwardPass.hlsl" + + // -------------------------------------------------- + // Visual Effect Vertex Invocations + #ifdef HAVE_VFX_MODIFICATION + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl" + #endif + + ENDHLSL + } + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Cull Off + ZTest LEqual + ZWrite On + ColorMask 0 + + // Debug + // + + // -------------------------------------------------- + // Pass + + HLSLPROGRAM + + // Pragmas + #pragma target 4.5 + #pragma exclude_renderers gles gles3 glcore + #pragma multi_compile_instancing + // #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma vertex vert + #pragma fragment frag + + // DotsInstancingOptions: + // HybridV1InjectedBuiltinProperties: + + // Keywords + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + // GraphKeywords: + + // Defines + + #define _NORMALMAP 1 + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define ATTRIBUTES_NEED_TEXCOORD3 + #define ATTRIBUTES_NEED_COLOR + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_TEXCOORD1 + #define VARYINGS_NEED_TEXCOORD2 + #define VARYINGS_NEED_TEXCOORD3 + #define VARYINGS_NEED_COLOR + #define VARYINGS_NEED_CULLFACE + #define FEATURES_GRAPH_VERTEX + /* WARNING: $splice Could not find named fragment 'PassInstancing' */ + #define SHADERPASS SHADERPASS_SHADOWCASTER + #define _ALPHATEST_ON 1 + /* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */ + + + // custom interpolator pre-include + /* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */ + + // 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/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + // -------------------------------------------------- + // Structs and Packing + + // custom interpolators pre packing + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */ + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + float4 uv3 : TEXCOORD3; + float4 color : COLOR; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : INSTANCEID_SEMANTIC; + #endif + }; + struct Varyings + { + float4 positionCS : SV_POSITION; + float3 normalWS; + float4 texCoord0; + float4 texCoord1; + float4 texCoord2; + float4 texCoord3; + float4 color; + #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 + }; + struct SurfaceDescriptionInputs + { + float4 uv0; + float4 uv1; + float4 uv2; + float4 uv3; + float4 VertexColor; + float FaceSign; + }; + struct VertexDescriptionInputs + { + float3 ObjectSpaceNormal; + float3 ObjectSpaceTangent; + float3 ObjectSpacePosition; + }; + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float3 interp0 : INTERP0; + float4 interp1 : INTERP1; + float4 interp2 : INTERP2; + float4 interp3 : INTERP3; + float4 interp4 : INTERP4; + float4 interp5 : INTERP5; + #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 + }; + + PackedVaryings PackVaryings (Varyings input) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + output.positionCS = input.positionCS; + output.interp0.xyz = input.normalWS; + output.interp1.xyzw = input.texCoord0; + output.interp2.xyzw = input.texCoord1; + output.interp3.xyzw = input.texCoord2; + output.interp4.xyzw = input.texCoord3; + output.interp5.xyzw = input.color; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + Varyings UnpackVaryings (PackedVaryings input) + { + Varyings output; + output.positionCS = input.positionCS; + output.normalWS = input.interp0.xyz; + output.texCoord0 = input.interp1.xyzw; + output.texCoord1 = input.interp2.xyzw; + output.texCoord2 = input.interp3.xyzw; + output.texCoord3 = input.interp4.xyzw; + output.color = input.interp5.xyzw; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + + // -------------------------------------------------- + // Graph + + // Graph Properties + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_TexelSize; + float2 _OutlineOffset1; + float2 _OutlineOffset2; + float2 _OutlineOffset3; + float _GradientScale; + float4 _FaceColor; + float4 _IsoPerimeter; + float4 _OutlineColor1; + float4 _OutlineColor2; + float4 _OutlineColor3; + float _OutlineMode; + float3 _Softness; + float4 _FaceTex_TexelSize; + float2 _FaceUVSpeed; + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + float2 _OutlineUVSpeed; + float4 _UnderlayColor; + float2 _UnderlayOffset; + float _UnderlayDilate; + float _UnderlaySoftness; + float _BevelType; + float _BevelAmount; + float _BevelOffset; + float _BevelWidth; + float _BevelRoundness; + float _BevelClamp; + float4 _SpecularColor; + float _LightAngle; + float _SpecularPower; + float _Reflectivity; + float _Diffuse; + float _Ambient; + float4 _OutlineTex_TexelSize; + float _ScaleRatioA; + float4 Emissive; + float _smoothness; + float _Metalic; + CBUFFER_END + + // Object and Global properties + SAMPLER(SamplerState_Linear_Repeat); + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + TEXTURE2D(_FaceTex); + SAMPLER(sampler_FaceTex); + SAMPLER(SamplerState_Linear_Clamp); + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + + // Graph Includes + #include "Assets/TextMesh Pro/Shaders/SDFFunctions.hlsl" + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + // Graph Functions + + void Unity_Combine_float(float R, float G, float B, float A, out float4 RGBA, out float3 RGB, out float2 RG) + { + RGBA = float4(R, G, B, A); + RGB = float3(R, G, B); + RG = float2(R, G); + } + + void Unity_Divide_float4(float4 A, float4 B, out float4 Out) + { + Out = A / B; + } + + void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out) + { + Out = A * B; + } + + void Unity_Subtract_float2(float2 A, float2 B, out float2 Out) + { + Out = A - B; + } + + void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out) + { + Out = A * B; + } + + // Custom interpolators pre vertex + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */ + + // Graph Vertex + struct VertexDescription + { + float3 Position; + float3 Normal; + float3 Tangent; + }; + + VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN) + { + VertexDescription description = (VertexDescription)0; + description.Position = IN.ObjectSpacePosition; + description.Normal = IN.ObjectSpaceNormal; + description.Tangent = IN.ObjectSpaceTangent; + return description; + } + + // Custom interpolators, pre surface + #ifdef FEATURES_GRAPH_VERTEX + Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input) + { + return output; + } + #define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC + #endif + + // Graph Pixel + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) + { + SurfaceDescription surface = (SurfaceDescription)0; + float4 _UV_533a59502f0abc8bb2c09828f32ebead_Out_0 = IN.uv0; + UnityTexture2D _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.z; + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Height_2 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.w; + float _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3; + ScreenSpaceRatio_float((_UV_533a59502f0abc8bb2c09828f32ebead_Out_0.xy), _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0, 0, _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3); + UnityTexture2D _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(IN.uv0.xy)); + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_R_4 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.r; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_G_5 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.g; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_B_6 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.b; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.a; + float4 _UV_b26868a97b712882abeca1b58698beb0_Out_0 = IN.uv0; + float2 _Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0 = _OutlineOffset1; + float _Property_c650c0154e947e898564d7d1d007d48e_Out_0 = _GradientScale; + UnityTexture2D _Property_6e377359c1349380b9482e9613fcec6b_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.z; + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.w; + float4 _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4; + float3 _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5; + float2 _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6; + Unity_Combine_float(_TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0, _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2, 0, 0, _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5, _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6); + float4 _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2; + Unity_Divide_float4((_Property_c650c0154e947e898564d7d1d007d48e_Out_0.xxxx), _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2); + float2 _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2; + Unity_Multiply_float2_float2(_Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2); + float2 _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2, _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2); + float4 _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_8ecda3d29d47068e8b76538959fab084_Out_2)); + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_R_4 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.r; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_G_5 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.g; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_B_6 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.b; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.a; + float2 _Property_5a3269796f550283a99abee895aeedd4_Out_0 = _OutlineOffset2; + float2 _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2; + Unity_Multiply_float2_float2((_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Property_5a3269796f550283a99abee895aeedd4_Out_0, _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2); + float2 _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2, _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2); + float4 _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2)); + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_R_4 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.r; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_G_5 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.g; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_B_6 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.b; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.a; + float2 _Property_20cbcbce438f6581847bd3da66673af8_Out_0 = _OutlineOffset3; + float2 _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2; + Unity_Multiply_float2_float2(_Property_20cbcbce438f6581847bd3da66673af8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2); + float2 _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2, _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2); + float4 _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2)); + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_R_4 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.r; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_G_5 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.g; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_B_6 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.b; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.a; + float4 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4; + float3 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5; + float2 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6; + Unity_Combine_float(_SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7, _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7, _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7, _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6); + float _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0 = _GradientScale; + float4 _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0 = _IsoPerimeter; + float3 _Property_05d545af6f7ff08387320e1130c67389_Out_0 = _Softness; + float _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0 = _OutlineMode; + float4 _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6; + ComputeSDF44_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0, _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0, (float4(_Property_05d545af6f7ff08387320e1130c67389_Out_0, 1.0)), _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0, _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6); + float4 _Property_eaed1eca838e7183ae708f9502a50dba_Out_0 = _FaceColor; + UnityTexture2D _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0 = UnityBuildTexture2DStructNoScale(_FaceTex); + float4 _UV_90e11fefcc71b18b8d88b417548d224f_Out_0 = IN.uv0; + float4 _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0 = _FaceTex_ST; + float2 _Property_ced4707a1339568eb002c789407f8a3b_Out_0 = _FaceUVSpeed; + float2 _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3; + GenerateUV_float((_UV_90e11fefcc71b18b8d88b417548d224f_Out_0.xy), _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0, _Property_ced4707a1339568eb002c789407f8a3b_Out_0, _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3); + float4 _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.tex, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.samplerstate, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.GetTransformedUV(_GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3)); + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_R_4 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.r; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_G_5 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.g; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_B_6 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.b; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_A_7 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.a; + float4 _Multiply_48133834a18f14828ac11b58bc205702_Out_2; + Unity_Multiply_float4_float4(_Property_eaed1eca838e7183ae708f9502a50dba_Out_0, _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0, _Multiply_48133834a18f14828ac11b58bc205702_Out_2); + float4 _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2; + Unity_Multiply_float4_float4(IN.VertexColor, _Multiply_48133834a18f14828ac11b58bc205702_Out_2, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2); + float4 _Property_4637336160f04f8397ca8f3b6531e88e_Out_0 = _OutlineColor1; + UnityTexture2D _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0 = UnityBuildTexture2DStructNoScale(_OutlineTex); + float4 _UV_343788cf38e6598db275321a22b05984_Out_0 = IN.uv0; + float4 _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0 = _OutlineTex_ST; + float2 _Property_11ca84fc4adc63868541229e4f404eae_Out_0 = _OutlineUVSpeed; + float2 _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3; + GenerateUV_float((_UV_343788cf38e6598db275321a22b05984_Out_0.xy), _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0, _Property_11ca84fc4adc63868541229e4f404eae_Out_0, _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3); + float4 _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.tex, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.samplerstate, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.GetTransformedUV(_GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3)); + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_R_4 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.r; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_G_5 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.g; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_B_6 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.b; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_A_7 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.a; + float4 _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2; + Unity_Multiply_float4_float4(_Property_4637336160f04f8397ca8f3b6531e88e_Out_0, _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2); + float4 _Property_6e8acbed3933c6819383cb89fe70a942_Out_0 = _OutlineColor2; + float2 _Property_baa8c75173022e86bde4cc075585af43_Out_0 = _OutlineOffset3; + float4 _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5; + Layer4_float(_ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2, _Property_6e8acbed3933c6819383cb89fe70a942_Out_0, (float4(_Property_baa8c75173022e86bde4cc075585af43_Out_0, 0.0, 1.0)), _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5); + UnityTexture2D _Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + UnityTexture2D _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_abc928409a963289955625c60e3c3674_Width_0 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.z; + float _TexelSize_abc928409a963289955625c60e3c3674_Height_2 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.w; + float4 _UV_7afe81a63629c789aece6cf7ed368769_Out_0 = IN.uv0; + float _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0 = max(0, IN.FaceSign.x); + float3 _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5; + GetSurfaceNormal_float(_Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0.tex, _TexelSize_abc928409a963289955625c60e3c3674_Width_0, _TexelSize_abc928409a963289955625c60e3c3674_Height_2, (_UV_7afe81a63629c789aece6cf7ed368769_Out_0).x, _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5); + float4 _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2; + EvaluateLight_float(_Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5, _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2); + UnityTexture2D _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _UV_87b50231796c43898a28be7b2f8daea3_Out_0 = IN.uv0; + float2 _Property_c20a130451687b8c87b5a623d8ca6d73_Out_0 = _UnderlayOffset; + float2 _Multiply_7d754a30a319c9839ca945e596548e63_Out_2; + Unity_Multiply_float2_float2(_Property_c20a130451687b8c87b5a623d8ca6d73_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2); + float2 _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2; + Unity_Subtract_float2((_UV_87b50231796c43898a28be7b2f8daea3_Out_0.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2, _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2); + float4 _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0 = SAMPLE_TEXTURE2D(_Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.tex, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.samplerstate, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.GetTransformedUV(_Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2)); + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_R_4 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.r; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_G_5 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.g; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_B_6 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.b; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_A_7 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.a; + float _Property_cb906f6db0fb388a91590590b04091ab_Out_0 = _GradientScale; + float _Property_22272afe5996178386aac669fbda451b_Out_0 = _UnderlayDilate; + float _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0 = _UnderlaySoftness; + float _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0; + ComputeSDF_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, (_SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0).x, _Property_cb906f6db0fb388a91590590b04091ab_Out_0, _Property_22272afe5996178386aac669fbda451b_Out_0, _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0, _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0); + float4 _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0 = _UnderlayColor; + float4 _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2; + Layer1_float(_ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0, _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2); + float4 _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2; + Composite_float(_EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2, _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2); + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_R_1 = IN.VertexColor[0]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_G_2 = IN.VertexColor[1]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_B_3 = IN.VertexColor[2]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4 = IN.VertexColor[3]; + float4 _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2; + Unity_Multiply_float4_float4(_CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2, (_Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4.xxxx), _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2); + float _Split_9b3e8141df129b848c4c1b364b613b86_R_1 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[0]; + float _Split_9b3e8141df129b848c4c1b364b613b86_G_2 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[1]; + float _Split_9b3e8141df129b848c4c1b364b613b86_B_3 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[2]; + float _Split_9b3e8141df129b848c4c1b364b613b86_A_4 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[3]; + surface.Alpha = _Split_9b3e8141df129b848c4c1b364b613b86_A_4; + surface.AlphaClipThreshold = 0.5; + return surface; + } + + // -------------------------------------------------- + // Build Graph Inputs + #ifdef HAVE_VFX_MODIFICATION + #define VFX_SRP_ATTRIBUTES Attributes + #define VFX_SRP_VARYINGS Varyings + #define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs + #endif + VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input) + { + VertexDescriptionInputs output; + ZERO_INITIALIZE(VertexDescriptionInputs, output); + + output.ObjectSpaceNormal = input.normalOS; + output.ObjectSpaceTangent = input.tangentOS.xyz; + output.ObjectSpacePosition = input.positionOS; + + return output; + } + SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) + { + SurfaceDescriptionInputs output; + ZERO_INITIALIZE(SurfaceDescriptionInputs, output); + + #ifdef HAVE_VFX_MODIFICATION + // FragInputs from VFX come from two places: Interpolator or CBuffer. + /* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */ + + #endif + + + + + + + + output.uv0 = input.texCoord0; + output.uv1 = input.texCoord1; + output.uv2 = input.texCoord2; + output.uv3 = input.texCoord3; + output.VertexColor = input.color; + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false); + #else + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #endif + BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + + return output; + } + + // -------------------------------------------------- + // Main + + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShadowCasterPass.hlsl" + + // -------------------------------------------------- + // Visual Effect Vertex Invocations + #ifdef HAVE_VFX_MODIFICATION + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl" + #endif + + ENDHLSL + } + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Off + ZTest LEqual + ZWrite On + + // Debug + // + + // -------------------------------------------------- + // Pass + + HLSLPROGRAM + + // Pragmas + #pragma target 4.5 + #pragma exclude_renderers gles gles3 glcore + #pragma multi_compile_instancing + //#pragma multi_compile _ DOTS_INSTANCING_ON + #pragma vertex vert + #pragma fragment frag + + // DotsInstancingOptions: + // HybridV1InjectedBuiltinProperties: + + // Keywords + // PassKeywords: + // GraphKeywords: + + // Defines + + #define _NORMALMAP 1 + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define ATTRIBUTES_NEED_TEXCOORD3 + #define ATTRIBUTES_NEED_COLOR + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_TEXCOORD1 + #define VARYINGS_NEED_TEXCOORD2 + #define VARYINGS_NEED_TEXCOORD3 + #define VARYINGS_NEED_COLOR + #define VARYINGS_NEED_CULLFACE + #define FEATURES_GRAPH_VERTEX + /* WARNING: $splice Could not find named fragment 'PassInstancing' */ + #define SHADERPASS SHADERPASS_DEPTHNORMALS + #define _ALPHATEST_ON 1 + /* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */ + + + // custom interpolator pre-include + /* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */ + + // 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/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + // -------------------------------------------------- + // Structs and Packing + + // custom interpolators pre packing + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */ + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + float4 uv3 : TEXCOORD3; + float4 color : COLOR; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : INSTANCEID_SEMANTIC; + #endif + }; + struct Varyings + { + float4 positionCS : SV_POSITION; + float3 normalWS; + float4 tangentWS; + float4 texCoord0; + float4 texCoord1; + float4 texCoord2; + float4 texCoord3; + float4 color; + #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 + }; + struct SurfaceDescriptionInputs + { + float3 TangentSpaceNormal; + float4 uv0; + float4 uv1; + float4 uv2; + float4 uv3; + float4 VertexColor; + float FaceSign; + }; + struct VertexDescriptionInputs + { + float3 ObjectSpaceNormal; + float3 ObjectSpaceTangent; + float3 ObjectSpacePosition; + }; + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float3 interp0 : INTERP0; + float4 interp1 : INTERP1; + float4 interp2 : INTERP2; + float4 interp3 : INTERP3; + float4 interp4 : INTERP4; + float4 interp5 : INTERP5; + float4 interp6 : INTERP6; + #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 + }; + + PackedVaryings PackVaryings (Varyings input) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + output.positionCS = input.positionCS; + output.interp0.xyz = input.normalWS; + output.interp1.xyzw = input.tangentWS; + output.interp2.xyzw = input.texCoord0; + output.interp3.xyzw = input.texCoord1; + output.interp4.xyzw = input.texCoord2; + output.interp5.xyzw = input.texCoord3; + output.interp6.xyzw = input.color; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + Varyings UnpackVaryings (PackedVaryings input) + { + Varyings output; + output.positionCS = input.positionCS; + output.normalWS = input.interp0.xyz; + output.tangentWS = input.interp1.xyzw; + output.texCoord0 = input.interp2.xyzw; + output.texCoord1 = input.interp3.xyzw; + output.texCoord2 = input.interp4.xyzw; + output.texCoord3 = input.interp5.xyzw; + output.color = input.interp6.xyzw; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + + // -------------------------------------------------- + // Graph + + // Graph Properties + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_TexelSize; + float2 _OutlineOffset1; + float2 _OutlineOffset2; + float2 _OutlineOffset3; + float _GradientScale; + float4 _FaceColor; + float4 _IsoPerimeter; + float4 _OutlineColor1; + float4 _OutlineColor2; + float4 _OutlineColor3; + float _OutlineMode; + float3 _Softness; + float4 _FaceTex_TexelSize; + float2 _FaceUVSpeed; + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + float2 _OutlineUVSpeed; + float4 _UnderlayColor; + float2 _UnderlayOffset; + float _UnderlayDilate; + float _UnderlaySoftness; + float _BevelType; + float _BevelAmount; + float _BevelOffset; + float _BevelWidth; + float _BevelRoundness; + float _BevelClamp; + float4 _SpecularColor; + float _LightAngle; + float _SpecularPower; + float _Reflectivity; + float _Diffuse; + float _Ambient; + float4 _OutlineTex_TexelSize; + float _ScaleRatioA; + float4 Emissive; + float _smoothness; + float _Metalic; + CBUFFER_END + + // Object and Global properties + SAMPLER(SamplerState_Linear_Repeat); + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + TEXTURE2D(_FaceTex); + SAMPLER(sampler_FaceTex); + SAMPLER(SamplerState_Linear_Clamp); + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + + // Graph Includes + #include "Assets/TextMesh Pro/Shaders/SDFFunctions.hlsl" + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + // Graph Functions + + void Unity_Combine_float(float R, float G, float B, float A, out float4 RGBA, out float3 RGB, out float2 RG) + { + RGBA = float4(R, G, B, A); + RGB = float3(R, G, B); + RG = float2(R, G); + } + + void Unity_Divide_float4(float4 A, float4 B, out float4 Out) + { + Out = A / B; + } + + void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out) + { + Out = A * B; + } + + void Unity_Subtract_float2(float2 A, float2 B, out float2 Out) + { + Out = A - B; + } + + void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out) + { + Out = A * B; + } + + // Custom interpolators pre vertex + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */ + + // Graph Vertex + struct VertexDescription + { + float3 Position; + float3 Normal; + float3 Tangent; + }; + + VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN) + { + VertexDescription description = (VertexDescription)0; + description.Position = IN.ObjectSpacePosition; + description.Normal = IN.ObjectSpaceNormal; + description.Tangent = IN.ObjectSpaceTangent; + return description; + } + + // Custom interpolators, pre surface + #ifdef FEATURES_GRAPH_VERTEX + Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input) + { + return output; + } + #define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC + #endif + + // Graph Pixel + struct SurfaceDescription + { + float3 NormalTS; + float Alpha; + float AlphaClipThreshold; + }; + + SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) + { + SurfaceDescription surface = (SurfaceDescription)0; + UnityTexture2D _Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + UnityTexture2D _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_abc928409a963289955625c60e3c3674_Width_0 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.z; + float _TexelSize_abc928409a963289955625c60e3c3674_Height_2 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.w; + float4 _UV_7afe81a63629c789aece6cf7ed368769_Out_0 = IN.uv0; + float _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0 = max(0, IN.FaceSign.x); + float3 _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5; + GetSurfaceNormal_float(_Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0.tex, _TexelSize_abc928409a963289955625c60e3c3674_Width_0, _TexelSize_abc928409a963289955625c60e3c3674_Height_2, (_UV_7afe81a63629c789aece6cf7ed368769_Out_0).x, _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5); + float4 _UV_533a59502f0abc8bb2c09828f32ebead_Out_0 = IN.uv0; + UnityTexture2D _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.z; + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Height_2 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.w; + float _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3; + ScreenSpaceRatio_float((_UV_533a59502f0abc8bb2c09828f32ebead_Out_0.xy), _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0, 0, _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3); + UnityTexture2D _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(IN.uv0.xy)); + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_R_4 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.r; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_G_5 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.g; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_B_6 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.b; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.a; + float4 _UV_b26868a97b712882abeca1b58698beb0_Out_0 = IN.uv0; + float2 _Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0 = _OutlineOffset1; + float _Property_c650c0154e947e898564d7d1d007d48e_Out_0 = _GradientScale; + UnityTexture2D _Property_6e377359c1349380b9482e9613fcec6b_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.z; + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.w; + float4 _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4; + float3 _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5; + float2 _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6; + Unity_Combine_float(_TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0, _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2, 0, 0, _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5, _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6); + float4 _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2; + Unity_Divide_float4((_Property_c650c0154e947e898564d7d1d007d48e_Out_0.xxxx), _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2); + float2 _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2; + Unity_Multiply_float2_float2(_Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2); + float2 _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2, _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2); + float4 _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_8ecda3d29d47068e8b76538959fab084_Out_2)); + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_R_4 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.r; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_G_5 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.g; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_B_6 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.b; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.a; + float2 _Property_5a3269796f550283a99abee895aeedd4_Out_0 = _OutlineOffset2; + float2 _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2; + Unity_Multiply_float2_float2((_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Property_5a3269796f550283a99abee895aeedd4_Out_0, _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2); + float2 _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2, _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2); + float4 _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2)); + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_R_4 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.r; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_G_5 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.g; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_B_6 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.b; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.a; + float2 _Property_20cbcbce438f6581847bd3da66673af8_Out_0 = _OutlineOffset3; + float2 _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2; + Unity_Multiply_float2_float2(_Property_20cbcbce438f6581847bd3da66673af8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2); + float2 _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2, _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2); + float4 _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2)); + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_R_4 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.r; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_G_5 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.g; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_B_6 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.b; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.a; + float4 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4; + float3 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5; + float2 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6; + Unity_Combine_float(_SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7, _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7, _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7, _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6); + float _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0 = _GradientScale; + float4 _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0 = _IsoPerimeter; + float3 _Property_05d545af6f7ff08387320e1130c67389_Out_0 = _Softness; + float _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0 = _OutlineMode; + float4 _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6; + ComputeSDF44_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0, _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0, (float4(_Property_05d545af6f7ff08387320e1130c67389_Out_0, 1.0)), _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0, _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6); + float4 _Property_eaed1eca838e7183ae708f9502a50dba_Out_0 = _FaceColor; + UnityTexture2D _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0 = UnityBuildTexture2DStructNoScale(_FaceTex); + float4 _UV_90e11fefcc71b18b8d88b417548d224f_Out_0 = IN.uv0; + float4 _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0 = _FaceTex_ST; + float2 _Property_ced4707a1339568eb002c789407f8a3b_Out_0 = _FaceUVSpeed; + float2 _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3; + GenerateUV_float((_UV_90e11fefcc71b18b8d88b417548d224f_Out_0.xy), _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0, _Property_ced4707a1339568eb002c789407f8a3b_Out_0, _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3); + float4 _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.tex, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.samplerstate, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.GetTransformedUV(_GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3)); + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_R_4 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.r; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_G_5 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.g; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_B_6 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.b; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_A_7 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.a; + float4 _Multiply_48133834a18f14828ac11b58bc205702_Out_2; + Unity_Multiply_float4_float4(_Property_eaed1eca838e7183ae708f9502a50dba_Out_0, _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0, _Multiply_48133834a18f14828ac11b58bc205702_Out_2); + float4 _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2; + Unity_Multiply_float4_float4(IN.VertexColor, _Multiply_48133834a18f14828ac11b58bc205702_Out_2, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2); + float4 _Property_4637336160f04f8397ca8f3b6531e88e_Out_0 = _OutlineColor1; + UnityTexture2D _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0 = UnityBuildTexture2DStructNoScale(_OutlineTex); + float4 _UV_343788cf38e6598db275321a22b05984_Out_0 = IN.uv0; + float4 _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0 = _OutlineTex_ST; + float2 _Property_11ca84fc4adc63868541229e4f404eae_Out_0 = _OutlineUVSpeed; + float2 _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3; + GenerateUV_float((_UV_343788cf38e6598db275321a22b05984_Out_0.xy), _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0, _Property_11ca84fc4adc63868541229e4f404eae_Out_0, _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3); + float4 _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.tex, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.samplerstate, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.GetTransformedUV(_GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3)); + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_R_4 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.r; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_G_5 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.g; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_B_6 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.b; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_A_7 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.a; + float4 _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2; + Unity_Multiply_float4_float4(_Property_4637336160f04f8397ca8f3b6531e88e_Out_0, _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2); + float4 _Property_6e8acbed3933c6819383cb89fe70a942_Out_0 = _OutlineColor2; + float2 _Property_baa8c75173022e86bde4cc075585af43_Out_0 = _OutlineOffset3; + float4 _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5; + Layer4_float(_ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2, _Property_6e8acbed3933c6819383cb89fe70a942_Out_0, (float4(_Property_baa8c75173022e86bde4cc075585af43_Out_0, 0.0, 1.0)), _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5); + float4 _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2; + EvaluateLight_float(_Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5, _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2); + UnityTexture2D _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _UV_87b50231796c43898a28be7b2f8daea3_Out_0 = IN.uv0; + float2 _Property_c20a130451687b8c87b5a623d8ca6d73_Out_0 = _UnderlayOffset; + float2 _Multiply_7d754a30a319c9839ca945e596548e63_Out_2; + Unity_Multiply_float2_float2(_Property_c20a130451687b8c87b5a623d8ca6d73_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2); + float2 _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2; + Unity_Subtract_float2((_UV_87b50231796c43898a28be7b2f8daea3_Out_0.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2, _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2); + float4 _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0 = SAMPLE_TEXTURE2D(_Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.tex, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.samplerstate, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.GetTransformedUV(_Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2)); + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_R_4 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.r; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_G_5 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.g; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_B_6 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.b; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_A_7 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.a; + float _Property_cb906f6db0fb388a91590590b04091ab_Out_0 = _GradientScale; + float _Property_22272afe5996178386aac669fbda451b_Out_0 = _UnderlayDilate; + float _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0 = _UnderlaySoftness; + float _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0; + ComputeSDF_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, (_SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0).x, _Property_cb906f6db0fb388a91590590b04091ab_Out_0, _Property_22272afe5996178386aac669fbda451b_Out_0, _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0, _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0); + float4 _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0 = _UnderlayColor; + float4 _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2; + Layer1_float(_ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0, _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2); + float4 _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2; + Composite_float(_EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2, _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2); + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_R_1 = IN.VertexColor[0]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_G_2 = IN.VertexColor[1]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_B_3 = IN.VertexColor[2]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4 = IN.VertexColor[3]; + float4 _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2; + Unity_Multiply_float4_float4(_CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2, (_Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4.xxxx), _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2); + float _Split_9b3e8141df129b848c4c1b364b613b86_R_1 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[0]; + float _Split_9b3e8141df129b848c4c1b364b613b86_G_2 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[1]; + float _Split_9b3e8141df129b848c4c1b364b613b86_B_3 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[2]; + float _Split_9b3e8141df129b848c4c1b364b613b86_A_4 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[3]; + surface.NormalTS = _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5; + surface.Alpha = _Split_9b3e8141df129b848c4c1b364b613b86_A_4; + surface.AlphaClipThreshold = 0.5; + return surface; + } + + // -------------------------------------------------- + // Build Graph Inputs + #ifdef HAVE_VFX_MODIFICATION + #define VFX_SRP_ATTRIBUTES Attributes + #define VFX_SRP_VARYINGS Varyings + #define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs + #endif + VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input) + { + VertexDescriptionInputs output; + ZERO_INITIALIZE(VertexDescriptionInputs, output); + + output.ObjectSpaceNormal = input.normalOS; + output.ObjectSpaceTangent = input.tangentOS.xyz; + output.ObjectSpacePosition = input.positionOS; + + return output; + } + SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) + { + SurfaceDescriptionInputs output; + ZERO_INITIALIZE(SurfaceDescriptionInputs, output); + + #ifdef HAVE_VFX_MODIFICATION + // FragInputs from VFX come from two places: Interpolator or CBuffer. + /* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */ + + #endif + + + + + + output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f); + + + output.uv0 = input.texCoord0; + output.uv1 = input.texCoord1; + output.uv2 = input.texCoord2; + output.uv3 = input.texCoord3; + output.VertexColor = input.color; + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false); + #else + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #endif + BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + + return output; + } + + // -------------------------------------------------- + // Main + + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DepthNormalsOnlyPass.hlsl" + + // -------------------------------------------------- + // Visual Effect Vertex Invocations + #ifdef HAVE_VFX_MODIFICATION + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl" + #endif + + ENDHLSL + } + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + // Render State + Cull Off + + // Debug + // + + // -------------------------------------------------- + // Pass + + HLSLPROGRAM + + // Pragmas + #pragma target 4.5 + #pragma exclude_renderers gles gles3 glcore + #pragma vertex vert + #pragma fragment frag + + // DotsInstancingOptions: + // HybridV1InjectedBuiltinProperties: + + // Keywords + #pragma shader_feature _ EDITOR_VISUALIZATION + // GraphKeywords: + + // Defines + + #define _NORMALMAP 1 + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define ATTRIBUTES_NEED_TEXCOORD3 + #define ATTRIBUTES_NEED_COLOR + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_TEXCOORD1 + #define VARYINGS_NEED_TEXCOORD2 + #define VARYINGS_NEED_TEXCOORD3 + #define VARYINGS_NEED_COLOR + #define VARYINGS_NEED_CULLFACE + #define FEATURES_GRAPH_VERTEX + /* WARNING: $splice Could not find named fragment 'PassInstancing' */ + #define SHADERPASS SHADERPASS_META + #define _FOG_FRAGMENT 1 + #define _ALPHATEST_ON 1 + /* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */ + + + // custom interpolator pre-include + /* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */ + + // 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/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + // -------------------------------------------------- + // Structs and Packing + + // custom interpolators pre packing + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */ + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + float4 uv3 : TEXCOORD3; + float4 color : COLOR; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : INSTANCEID_SEMANTIC; + #endif + }; + struct Varyings + { + float4 positionCS : SV_POSITION; + float4 texCoord0; + float4 texCoord1; + float4 texCoord2; + float4 texCoord3; + float4 color; + #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 + }; + struct SurfaceDescriptionInputs + { + float4 uv0; + float4 uv1; + float4 uv2; + float4 uv3; + float4 VertexColor; + float FaceSign; + }; + struct VertexDescriptionInputs + { + float3 ObjectSpaceNormal; + float3 ObjectSpaceTangent; + float3 ObjectSpacePosition; + }; + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float4 interp0 : INTERP0; + float4 interp1 : INTERP1; + float4 interp2 : INTERP2; + float4 interp3 : INTERP3; + float4 interp4 : INTERP4; + #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 + }; + + PackedVaryings PackVaryings (Varyings input) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + output.positionCS = input.positionCS; + output.interp0.xyzw = input.texCoord0; + output.interp1.xyzw = input.texCoord1; + output.interp2.xyzw = input.texCoord2; + output.interp3.xyzw = input.texCoord3; + output.interp4.xyzw = input.color; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + Varyings UnpackVaryings (PackedVaryings input) + { + Varyings output; + output.positionCS = input.positionCS; + output.texCoord0 = input.interp0.xyzw; + output.texCoord1 = input.interp1.xyzw; + output.texCoord2 = input.interp2.xyzw; + output.texCoord3 = input.interp3.xyzw; + output.color = input.interp4.xyzw; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + + // -------------------------------------------------- + // Graph + + // Graph Properties + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_TexelSize; + float2 _OutlineOffset1; + float2 _OutlineOffset2; + float2 _OutlineOffset3; + float _GradientScale; + float4 _FaceColor; + float4 _IsoPerimeter; + float4 _OutlineColor1; + float4 _OutlineColor2; + float4 _OutlineColor3; + float _OutlineMode; + float3 _Softness; + float4 _FaceTex_TexelSize; + float2 _FaceUVSpeed; + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + float2 _OutlineUVSpeed; + float4 _UnderlayColor; + float2 _UnderlayOffset; + float _UnderlayDilate; + float _UnderlaySoftness; + float _BevelType; + float _BevelAmount; + float _BevelOffset; + float _BevelWidth; + float _BevelRoundness; + float _BevelClamp; + float4 _SpecularColor; + float _LightAngle; + float _SpecularPower; + float _Reflectivity; + float _Diffuse; + float _Ambient; + float4 _OutlineTex_TexelSize; + float _ScaleRatioA; + float4 Emissive; + float _smoothness; + float _Metalic; + CBUFFER_END + + // Object and Global properties + SAMPLER(SamplerState_Linear_Repeat); + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + TEXTURE2D(_FaceTex); + SAMPLER(sampler_FaceTex); + SAMPLER(SamplerState_Linear_Clamp); + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + + // Graph Includes + #include "Assets/TextMesh Pro/Shaders/SDFFunctions.hlsl" + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + // Graph Functions + + void Unity_Combine_float(float R, float G, float B, float A, out float4 RGBA, out float3 RGB, out float2 RG) + { + RGBA = float4(R, G, B, A); + RGB = float3(R, G, B); + RG = float2(R, G); + } + + void Unity_Divide_float4(float4 A, float4 B, out float4 Out) + { + Out = A / B; + } + + void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out) + { + Out = A * B; + } + + void Unity_Subtract_float2(float2 A, float2 B, out float2 Out) + { + Out = A - B; + } + + void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out) + { + Out = A * B; + } + + // Custom interpolators pre vertex + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */ + + // Graph Vertex + struct VertexDescription + { + float3 Position; + float3 Normal; + float3 Tangent; + }; + + VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN) + { + VertexDescription description = (VertexDescription)0; + description.Position = IN.ObjectSpacePosition; + description.Normal = IN.ObjectSpaceNormal; + description.Tangent = IN.ObjectSpaceTangent; + return description; + } + + // Custom interpolators, pre surface + #ifdef FEATURES_GRAPH_VERTEX + Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input) + { + return output; + } + #define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC + #endif + + // Graph Pixel + struct SurfaceDescription + { + float3 BaseColor; + float3 Emission; + float Alpha; + float AlphaClipThreshold; + }; + + SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) + { + SurfaceDescription surface = (SurfaceDescription)0; + float4 _UV_533a59502f0abc8bb2c09828f32ebead_Out_0 = IN.uv0; + UnityTexture2D _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.z; + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Height_2 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.w; + float _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3; + ScreenSpaceRatio_float((_UV_533a59502f0abc8bb2c09828f32ebead_Out_0.xy), _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0, 0, _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3); + UnityTexture2D _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(IN.uv0.xy)); + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_R_4 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.r; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_G_5 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.g; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_B_6 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.b; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.a; + float4 _UV_b26868a97b712882abeca1b58698beb0_Out_0 = IN.uv0; + float2 _Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0 = _OutlineOffset1; + float _Property_c650c0154e947e898564d7d1d007d48e_Out_0 = _GradientScale; + UnityTexture2D _Property_6e377359c1349380b9482e9613fcec6b_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.z; + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.w; + float4 _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4; + float3 _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5; + float2 _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6; + Unity_Combine_float(_TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0, _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2, 0, 0, _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5, _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6); + float4 _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2; + Unity_Divide_float4((_Property_c650c0154e947e898564d7d1d007d48e_Out_0.xxxx), _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2); + float2 _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2; + Unity_Multiply_float2_float2(_Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2); + float2 _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2, _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2); + float4 _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_8ecda3d29d47068e8b76538959fab084_Out_2)); + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_R_4 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.r; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_G_5 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.g; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_B_6 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.b; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.a; + float2 _Property_5a3269796f550283a99abee895aeedd4_Out_0 = _OutlineOffset2; + float2 _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2; + Unity_Multiply_float2_float2((_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Property_5a3269796f550283a99abee895aeedd4_Out_0, _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2); + float2 _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2, _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2); + float4 _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2)); + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_R_4 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.r; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_G_5 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.g; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_B_6 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.b; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.a; + float2 _Property_20cbcbce438f6581847bd3da66673af8_Out_0 = _OutlineOffset3; + float2 _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2; + Unity_Multiply_float2_float2(_Property_20cbcbce438f6581847bd3da66673af8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2); + float2 _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2, _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2); + float4 _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2)); + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_R_4 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.r; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_G_5 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.g; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_B_6 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.b; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.a; + float4 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4; + float3 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5; + float2 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6; + Unity_Combine_float(_SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7, _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7, _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7, _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6); + float _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0 = _GradientScale; + float4 _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0 = _IsoPerimeter; + float3 _Property_05d545af6f7ff08387320e1130c67389_Out_0 = _Softness; + float _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0 = _OutlineMode; + float4 _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6; + ComputeSDF44_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0, _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0, (float4(_Property_05d545af6f7ff08387320e1130c67389_Out_0, 1.0)), _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0, _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6); + float4 _Property_eaed1eca838e7183ae708f9502a50dba_Out_0 = _FaceColor; + UnityTexture2D _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0 = UnityBuildTexture2DStructNoScale(_FaceTex); + float4 _UV_90e11fefcc71b18b8d88b417548d224f_Out_0 = IN.uv0; + float4 _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0 = _FaceTex_ST; + float2 _Property_ced4707a1339568eb002c789407f8a3b_Out_0 = _FaceUVSpeed; + float2 _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3; + GenerateUV_float((_UV_90e11fefcc71b18b8d88b417548d224f_Out_0.xy), _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0, _Property_ced4707a1339568eb002c789407f8a3b_Out_0, _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3); + float4 _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.tex, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.samplerstate, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.GetTransformedUV(_GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3)); + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_R_4 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.r; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_G_5 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.g; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_B_6 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.b; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_A_7 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.a; + float4 _Multiply_48133834a18f14828ac11b58bc205702_Out_2; + Unity_Multiply_float4_float4(_Property_eaed1eca838e7183ae708f9502a50dba_Out_0, _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0, _Multiply_48133834a18f14828ac11b58bc205702_Out_2); + float4 _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2; + Unity_Multiply_float4_float4(IN.VertexColor, _Multiply_48133834a18f14828ac11b58bc205702_Out_2, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2); + float4 _Property_4637336160f04f8397ca8f3b6531e88e_Out_0 = _OutlineColor1; + UnityTexture2D _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0 = UnityBuildTexture2DStructNoScale(_OutlineTex); + float4 _UV_343788cf38e6598db275321a22b05984_Out_0 = IN.uv0; + float4 _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0 = _OutlineTex_ST; + float2 _Property_11ca84fc4adc63868541229e4f404eae_Out_0 = _OutlineUVSpeed; + float2 _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3; + GenerateUV_float((_UV_343788cf38e6598db275321a22b05984_Out_0.xy), _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0, _Property_11ca84fc4adc63868541229e4f404eae_Out_0, _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3); + float4 _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.tex, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.samplerstate, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.GetTransformedUV(_GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3)); + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_R_4 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.r; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_G_5 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.g; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_B_6 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.b; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_A_7 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.a; + float4 _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2; + Unity_Multiply_float4_float4(_Property_4637336160f04f8397ca8f3b6531e88e_Out_0, _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2); + float4 _Property_6e8acbed3933c6819383cb89fe70a942_Out_0 = _OutlineColor2; + float2 _Property_baa8c75173022e86bde4cc075585af43_Out_0 = _OutlineOffset3; + float4 _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5; + Layer4_float(_ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2, _Property_6e8acbed3933c6819383cb89fe70a942_Out_0, (float4(_Property_baa8c75173022e86bde4cc075585af43_Out_0, 0.0, 1.0)), _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5); + UnityTexture2D _Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + UnityTexture2D _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_abc928409a963289955625c60e3c3674_Width_0 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.z; + float _TexelSize_abc928409a963289955625c60e3c3674_Height_2 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.w; + float4 _UV_7afe81a63629c789aece6cf7ed368769_Out_0 = IN.uv0; + float _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0 = max(0, IN.FaceSign.x); + float3 _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5; + GetSurfaceNormal_float(_Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0.tex, _TexelSize_abc928409a963289955625c60e3c3674_Width_0, _TexelSize_abc928409a963289955625c60e3c3674_Height_2, (_UV_7afe81a63629c789aece6cf7ed368769_Out_0).x, _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5); + float4 _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2; + EvaluateLight_float(_Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5, _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2); + UnityTexture2D _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _UV_87b50231796c43898a28be7b2f8daea3_Out_0 = IN.uv0; + float2 _Property_c20a130451687b8c87b5a623d8ca6d73_Out_0 = _UnderlayOffset; + float2 _Multiply_7d754a30a319c9839ca945e596548e63_Out_2; + Unity_Multiply_float2_float2(_Property_c20a130451687b8c87b5a623d8ca6d73_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2); + float2 _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2; + Unity_Subtract_float2((_UV_87b50231796c43898a28be7b2f8daea3_Out_0.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2, _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2); + float4 _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0 = SAMPLE_TEXTURE2D(_Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.tex, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.samplerstate, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.GetTransformedUV(_Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2)); + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_R_4 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.r; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_G_5 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.g; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_B_6 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.b; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_A_7 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.a; + float _Property_cb906f6db0fb388a91590590b04091ab_Out_0 = _GradientScale; + float _Property_22272afe5996178386aac669fbda451b_Out_0 = _UnderlayDilate; + float _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0 = _UnderlaySoftness; + float _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0; + ComputeSDF_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, (_SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0).x, _Property_cb906f6db0fb388a91590590b04091ab_Out_0, _Property_22272afe5996178386aac669fbda451b_Out_0, _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0, _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0); + float4 _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0 = _UnderlayColor; + float4 _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2; + Layer1_float(_ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0, _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2); + float4 _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2; + Composite_float(_EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2, _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2); + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_R_1 = IN.VertexColor[0]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_G_2 = IN.VertexColor[1]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_B_3 = IN.VertexColor[2]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4 = IN.VertexColor[3]; + float4 _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2; + Unity_Multiply_float4_float4(_CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2, (_Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4.xxxx), _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2); + float4 _Property_c74b31cf958e978797249554cd8dd6be_Out_0 = Emissive; + float4 _Multiply_e1a973f199b55389b5df6b0985db43a7_Out_2; + Unity_Multiply_float4_float4(_Property_c74b31cf958e978797249554cd8dd6be_Out_0, _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2, _Multiply_e1a973f199b55389b5df6b0985db43a7_Out_2); + float _Split_9b3e8141df129b848c4c1b364b613b86_R_1 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[0]; + float _Split_9b3e8141df129b848c4c1b364b613b86_G_2 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[1]; + float _Split_9b3e8141df129b848c4c1b364b613b86_B_3 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[2]; + float _Split_9b3e8141df129b848c4c1b364b613b86_A_4 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[3]; + float4 _Multiply_b32230c509acbc8f89fb8f34c19f9513_Out_2; + Unity_Multiply_float4_float4(_Multiply_e1a973f199b55389b5df6b0985db43a7_Out_2, (_Split_9b3e8141df129b848c4c1b364b613b86_A_4.xxxx), _Multiply_b32230c509acbc8f89fb8f34c19f9513_Out_2); + surface.BaseColor = (_Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2.xyz); + surface.Emission = (_Multiply_b32230c509acbc8f89fb8f34c19f9513_Out_2.xyz); + surface.Alpha = _Split_9b3e8141df129b848c4c1b364b613b86_A_4; + surface.AlphaClipThreshold = 0.5; + return surface; + } + + // -------------------------------------------------- + // Build Graph Inputs + #ifdef HAVE_VFX_MODIFICATION + #define VFX_SRP_ATTRIBUTES Attributes + #define VFX_SRP_VARYINGS Varyings + #define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs + #endif + VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input) + { + VertexDescriptionInputs output; + ZERO_INITIALIZE(VertexDescriptionInputs, output); + + output.ObjectSpaceNormal = input.normalOS; + output.ObjectSpaceTangent = input.tangentOS.xyz; + output.ObjectSpacePosition = input.positionOS; + + return output; + } + SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) + { + SurfaceDescriptionInputs output; + ZERO_INITIALIZE(SurfaceDescriptionInputs, output); + + #ifdef HAVE_VFX_MODIFICATION + // FragInputs from VFX come from two places: Interpolator or CBuffer. + /* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */ + + #endif + + + + + + + + output.uv0 = input.texCoord0; + output.uv1 = input.texCoord1; + output.uv2 = input.texCoord2; + output.uv3 = input.texCoord3; + output.VertexColor = input.color; + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false); + #else + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #endif + BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + + return output; + } + + // -------------------------------------------------- + // Main + + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/LightingMetaPass.hlsl" + + // -------------------------------------------------- + // Visual Effect Vertex Invocations + #ifdef HAVE_VFX_MODIFICATION + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl" + #endif + + ENDHLSL + } + Pass + { + Name "SceneSelectionPass" + Tags + { + "LightMode" = "SceneSelectionPass" + } + + // Render State + Cull Off + + // Debug + // + + // -------------------------------------------------- + // Pass + + HLSLPROGRAM + + // Pragmas + #pragma target 4.5 + #pragma exclude_renderers gles gles3 glcore + #pragma vertex vert + #pragma fragment frag + + // DotsInstancingOptions: + // HybridV1InjectedBuiltinProperties: + + // Keywords + // PassKeywords: + // GraphKeywords: + + // Defines + + #define _NORMALMAP 1 + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define ATTRIBUTES_NEED_TEXCOORD3 + #define ATTRIBUTES_NEED_COLOR + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_TEXCOORD1 + #define VARYINGS_NEED_TEXCOORD2 + #define VARYINGS_NEED_TEXCOORD3 + #define VARYINGS_NEED_COLOR + #define VARYINGS_NEED_CULLFACE + #define FEATURES_GRAPH_VERTEX + /* WARNING: $splice Could not find named fragment 'PassInstancing' */ + #define SHADERPASS SHADERPASS_DEPTHONLY + #define SCENESELECTIONPASS 1 + #define ALPHA_CLIP_THRESHOLD 1 + #define _ALPHATEST_ON 1 + /* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */ + + + // custom interpolator pre-include + /* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */ + + // 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/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + // -------------------------------------------------- + // Structs and Packing + + // custom interpolators pre packing + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */ + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + float4 uv3 : TEXCOORD3; + float4 color : COLOR; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : INSTANCEID_SEMANTIC; + #endif + }; + struct Varyings + { + float4 positionCS : SV_POSITION; + float4 texCoord0; + float4 texCoord1; + float4 texCoord2; + float4 texCoord3; + float4 color; + #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 + }; + struct SurfaceDescriptionInputs + { + float4 uv0; + float4 uv1; + float4 uv2; + float4 uv3; + float4 VertexColor; + float FaceSign; + }; + struct VertexDescriptionInputs + { + float3 ObjectSpaceNormal; + float3 ObjectSpaceTangent; + float3 ObjectSpacePosition; + }; + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float4 interp0 : INTERP0; + float4 interp1 : INTERP1; + float4 interp2 : INTERP2; + float4 interp3 : INTERP3; + float4 interp4 : INTERP4; + #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 + }; + + PackedVaryings PackVaryings (Varyings input) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + output.positionCS = input.positionCS; + output.interp0.xyzw = input.texCoord0; + output.interp1.xyzw = input.texCoord1; + output.interp2.xyzw = input.texCoord2; + output.interp3.xyzw = input.texCoord3; + output.interp4.xyzw = input.color; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + Varyings UnpackVaryings (PackedVaryings input) + { + Varyings output; + output.positionCS = input.positionCS; + output.texCoord0 = input.interp0.xyzw; + output.texCoord1 = input.interp1.xyzw; + output.texCoord2 = input.interp2.xyzw; + output.texCoord3 = input.interp3.xyzw; + output.color = input.interp4.xyzw; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + + // -------------------------------------------------- + // Graph + + // Graph Properties + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_TexelSize; + float2 _OutlineOffset1; + float2 _OutlineOffset2; + float2 _OutlineOffset3; + float _GradientScale; + float4 _FaceColor; + float4 _IsoPerimeter; + float4 _OutlineColor1; + float4 _OutlineColor2; + float4 _OutlineColor3; + float _OutlineMode; + float3 _Softness; + float4 _FaceTex_TexelSize; + float2 _FaceUVSpeed; + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + float2 _OutlineUVSpeed; + float4 _UnderlayColor; + float2 _UnderlayOffset; + float _UnderlayDilate; + float _UnderlaySoftness; + float _BevelType; + float _BevelAmount; + float _BevelOffset; + float _BevelWidth; + float _BevelRoundness; + float _BevelClamp; + float4 _SpecularColor; + float _LightAngle; + float _SpecularPower; + float _Reflectivity; + float _Diffuse; + float _Ambient; + float4 _OutlineTex_TexelSize; + float _ScaleRatioA; + float4 Emissive; + float _smoothness; + float _Metalic; + CBUFFER_END + + // Object and Global properties + SAMPLER(SamplerState_Linear_Repeat); + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + TEXTURE2D(_FaceTex); + SAMPLER(sampler_FaceTex); + SAMPLER(SamplerState_Linear_Clamp); + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + + // Graph Includes + #include "Assets/TextMesh Pro/Shaders/SDFFunctions.hlsl" + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + // Graph Functions + + void Unity_Combine_float(float R, float G, float B, float A, out float4 RGBA, out float3 RGB, out float2 RG) + { + RGBA = float4(R, G, B, A); + RGB = float3(R, G, B); + RG = float2(R, G); + } + + void Unity_Divide_float4(float4 A, float4 B, out float4 Out) + { + Out = A / B; + } + + void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out) + { + Out = A * B; + } + + void Unity_Subtract_float2(float2 A, float2 B, out float2 Out) + { + Out = A - B; + } + + void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out) + { + Out = A * B; + } + + // Custom interpolators pre vertex + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */ + + // Graph Vertex + struct VertexDescription + { + float3 Position; + float3 Normal; + float3 Tangent; + }; + + VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN) + { + VertexDescription description = (VertexDescription)0; + description.Position = IN.ObjectSpacePosition; + description.Normal = IN.ObjectSpaceNormal; + description.Tangent = IN.ObjectSpaceTangent; + return description; + } + + // Custom interpolators, pre surface + #ifdef FEATURES_GRAPH_VERTEX + Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input) + { + return output; + } + #define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC + #endif + + // Graph Pixel + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) + { + SurfaceDescription surface = (SurfaceDescription)0; + float4 _UV_533a59502f0abc8bb2c09828f32ebead_Out_0 = IN.uv0; + UnityTexture2D _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.z; + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Height_2 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.w; + float _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3; + ScreenSpaceRatio_float((_UV_533a59502f0abc8bb2c09828f32ebead_Out_0.xy), _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0, 0, _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3); + UnityTexture2D _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(IN.uv0.xy)); + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_R_4 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.r; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_G_5 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.g; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_B_6 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.b; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.a; + float4 _UV_b26868a97b712882abeca1b58698beb0_Out_0 = IN.uv0; + float2 _Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0 = _OutlineOffset1; + float _Property_c650c0154e947e898564d7d1d007d48e_Out_0 = _GradientScale; + UnityTexture2D _Property_6e377359c1349380b9482e9613fcec6b_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.z; + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.w; + float4 _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4; + float3 _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5; + float2 _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6; + Unity_Combine_float(_TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0, _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2, 0, 0, _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5, _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6); + float4 _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2; + Unity_Divide_float4((_Property_c650c0154e947e898564d7d1d007d48e_Out_0.xxxx), _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2); + float2 _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2; + Unity_Multiply_float2_float2(_Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2); + float2 _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2, _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2); + float4 _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_8ecda3d29d47068e8b76538959fab084_Out_2)); + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_R_4 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.r; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_G_5 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.g; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_B_6 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.b; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.a; + float2 _Property_5a3269796f550283a99abee895aeedd4_Out_0 = _OutlineOffset2; + float2 _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2; + Unity_Multiply_float2_float2((_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Property_5a3269796f550283a99abee895aeedd4_Out_0, _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2); + float2 _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2, _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2); + float4 _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2)); + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_R_4 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.r; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_G_5 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.g; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_B_6 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.b; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.a; + float2 _Property_20cbcbce438f6581847bd3da66673af8_Out_0 = _OutlineOffset3; + float2 _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2; + Unity_Multiply_float2_float2(_Property_20cbcbce438f6581847bd3da66673af8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2); + float2 _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2, _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2); + float4 _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2)); + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_R_4 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.r; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_G_5 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.g; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_B_6 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.b; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.a; + float4 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4; + float3 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5; + float2 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6; + Unity_Combine_float(_SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7, _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7, _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7, _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6); + float _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0 = _GradientScale; + float4 _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0 = _IsoPerimeter; + float3 _Property_05d545af6f7ff08387320e1130c67389_Out_0 = _Softness; + float _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0 = _OutlineMode; + float4 _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6; + ComputeSDF44_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0, _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0, (float4(_Property_05d545af6f7ff08387320e1130c67389_Out_0, 1.0)), _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0, _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6); + float4 _Property_eaed1eca838e7183ae708f9502a50dba_Out_0 = _FaceColor; + UnityTexture2D _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0 = UnityBuildTexture2DStructNoScale(_FaceTex); + float4 _UV_90e11fefcc71b18b8d88b417548d224f_Out_0 = IN.uv0; + float4 _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0 = _FaceTex_ST; + float2 _Property_ced4707a1339568eb002c789407f8a3b_Out_0 = _FaceUVSpeed; + float2 _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3; + GenerateUV_float((_UV_90e11fefcc71b18b8d88b417548d224f_Out_0.xy), _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0, _Property_ced4707a1339568eb002c789407f8a3b_Out_0, _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3); + float4 _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.tex, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.samplerstate, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.GetTransformedUV(_GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3)); + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_R_4 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.r; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_G_5 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.g; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_B_6 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.b; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_A_7 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.a; + float4 _Multiply_48133834a18f14828ac11b58bc205702_Out_2; + Unity_Multiply_float4_float4(_Property_eaed1eca838e7183ae708f9502a50dba_Out_0, _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0, _Multiply_48133834a18f14828ac11b58bc205702_Out_2); + float4 _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2; + Unity_Multiply_float4_float4(IN.VertexColor, _Multiply_48133834a18f14828ac11b58bc205702_Out_2, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2); + float4 _Property_4637336160f04f8397ca8f3b6531e88e_Out_0 = _OutlineColor1; + UnityTexture2D _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0 = UnityBuildTexture2DStructNoScale(_OutlineTex); + float4 _UV_343788cf38e6598db275321a22b05984_Out_0 = IN.uv0; + float4 _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0 = _OutlineTex_ST; + float2 _Property_11ca84fc4adc63868541229e4f404eae_Out_0 = _OutlineUVSpeed; + float2 _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3; + GenerateUV_float((_UV_343788cf38e6598db275321a22b05984_Out_0.xy), _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0, _Property_11ca84fc4adc63868541229e4f404eae_Out_0, _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3); + float4 _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.tex, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.samplerstate, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.GetTransformedUV(_GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3)); + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_R_4 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.r; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_G_5 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.g; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_B_6 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.b; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_A_7 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.a; + float4 _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2; + Unity_Multiply_float4_float4(_Property_4637336160f04f8397ca8f3b6531e88e_Out_0, _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2); + float4 _Property_6e8acbed3933c6819383cb89fe70a942_Out_0 = _OutlineColor2; + float2 _Property_baa8c75173022e86bde4cc075585af43_Out_0 = _OutlineOffset3; + float4 _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5; + Layer4_float(_ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2, _Property_6e8acbed3933c6819383cb89fe70a942_Out_0, (float4(_Property_baa8c75173022e86bde4cc075585af43_Out_0, 0.0, 1.0)), _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5); + UnityTexture2D _Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + UnityTexture2D _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_abc928409a963289955625c60e3c3674_Width_0 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.z; + float _TexelSize_abc928409a963289955625c60e3c3674_Height_2 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.w; + float4 _UV_7afe81a63629c789aece6cf7ed368769_Out_0 = IN.uv0; + float _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0 = max(0, IN.FaceSign.x); + float3 _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5; + GetSurfaceNormal_float(_Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0.tex, _TexelSize_abc928409a963289955625c60e3c3674_Width_0, _TexelSize_abc928409a963289955625c60e3c3674_Height_2, (_UV_7afe81a63629c789aece6cf7ed368769_Out_0).x, _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5); + float4 _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2; + EvaluateLight_float(_Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5, _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2); + UnityTexture2D _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _UV_87b50231796c43898a28be7b2f8daea3_Out_0 = IN.uv0; + float2 _Property_c20a130451687b8c87b5a623d8ca6d73_Out_0 = _UnderlayOffset; + float2 _Multiply_7d754a30a319c9839ca945e596548e63_Out_2; + Unity_Multiply_float2_float2(_Property_c20a130451687b8c87b5a623d8ca6d73_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2); + float2 _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2; + Unity_Subtract_float2((_UV_87b50231796c43898a28be7b2f8daea3_Out_0.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2, _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2); + float4 _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0 = SAMPLE_TEXTURE2D(_Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.tex, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.samplerstate, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.GetTransformedUV(_Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2)); + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_R_4 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.r; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_G_5 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.g; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_B_6 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.b; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_A_7 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.a; + float _Property_cb906f6db0fb388a91590590b04091ab_Out_0 = _GradientScale; + float _Property_22272afe5996178386aac669fbda451b_Out_0 = _UnderlayDilate; + float _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0 = _UnderlaySoftness; + float _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0; + ComputeSDF_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, (_SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0).x, _Property_cb906f6db0fb388a91590590b04091ab_Out_0, _Property_22272afe5996178386aac669fbda451b_Out_0, _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0, _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0); + float4 _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0 = _UnderlayColor; + float4 _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2; + Layer1_float(_ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0, _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2); + float4 _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2; + Composite_float(_EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2, _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2); + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_R_1 = IN.VertexColor[0]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_G_2 = IN.VertexColor[1]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_B_3 = IN.VertexColor[2]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4 = IN.VertexColor[3]; + float4 _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2; + Unity_Multiply_float4_float4(_CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2, (_Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4.xxxx), _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2); + float _Split_9b3e8141df129b848c4c1b364b613b86_R_1 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[0]; + float _Split_9b3e8141df129b848c4c1b364b613b86_G_2 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[1]; + float _Split_9b3e8141df129b848c4c1b364b613b86_B_3 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[2]; + float _Split_9b3e8141df129b848c4c1b364b613b86_A_4 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[3]; + surface.Alpha = _Split_9b3e8141df129b848c4c1b364b613b86_A_4; + surface.AlphaClipThreshold = 0.5; + return surface; + } + + // -------------------------------------------------- + // Build Graph Inputs + #ifdef HAVE_VFX_MODIFICATION + #define VFX_SRP_ATTRIBUTES Attributes + #define VFX_SRP_VARYINGS Varyings + #define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs + #endif + VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input) + { + VertexDescriptionInputs output; + ZERO_INITIALIZE(VertexDescriptionInputs, output); + + output.ObjectSpaceNormal = input.normalOS; + output.ObjectSpaceTangent = input.tangentOS.xyz; + output.ObjectSpacePosition = input.positionOS; + + return output; + } + SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) + { + SurfaceDescriptionInputs output; + ZERO_INITIALIZE(SurfaceDescriptionInputs, output); + + #ifdef HAVE_VFX_MODIFICATION + // FragInputs from VFX come from two places: Interpolator or CBuffer. + /* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */ + + #endif + + + + + + + + output.uv0 = input.texCoord0; + output.uv1 = input.texCoord1; + output.uv2 = input.texCoord2; + output.uv3 = input.texCoord3; + output.VertexColor = input.color; + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false); + #else + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #endif + BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + + return output; + } + + // -------------------------------------------------- + // Main + + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/SelectionPickingPass.hlsl" + + // -------------------------------------------------- + // Visual Effect Vertex Invocations + #ifdef HAVE_VFX_MODIFICATION + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl" + #endif + + ENDHLSL + } + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + // Render State + Cull Off + + // Debug + // + + // -------------------------------------------------- + // Pass + + HLSLPROGRAM + + // Pragmas + #pragma target 4.5 + #pragma exclude_renderers gles gles3 glcore + #pragma vertex vert + #pragma fragment frag + + // DotsInstancingOptions: + // HybridV1InjectedBuiltinProperties: + + // Keywords + // PassKeywords: + // GraphKeywords: + + // Defines + + #define _NORMALMAP 1 + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define ATTRIBUTES_NEED_TEXCOORD3 + #define ATTRIBUTES_NEED_COLOR + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_TEXCOORD1 + #define VARYINGS_NEED_TEXCOORD2 + #define VARYINGS_NEED_TEXCOORD3 + #define VARYINGS_NEED_COLOR + #define VARYINGS_NEED_CULLFACE + #define FEATURES_GRAPH_VERTEX + /* WARNING: $splice Could not find named fragment 'PassInstancing' */ + #define SHADERPASS SHADERPASS_DEPTHONLY + #define SCENEPICKINGPASS 1 + #define ALPHA_CLIP_THRESHOLD 1 + #define _ALPHATEST_ON 1 + /* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */ + + + // custom interpolator pre-include + /* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */ + + // 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/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + // -------------------------------------------------- + // Structs and Packing + + // custom interpolators pre packing + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */ + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + float4 uv3 : TEXCOORD3; + float4 color : COLOR; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : INSTANCEID_SEMANTIC; + #endif + }; + struct Varyings + { + float4 positionCS : SV_POSITION; + float4 texCoord0; + float4 texCoord1; + float4 texCoord2; + float4 texCoord3; + float4 color; + #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 + }; + struct SurfaceDescriptionInputs + { + float4 uv0; + float4 uv1; + float4 uv2; + float4 uv3; + float4 VertexColor; + float FaceSign; + }; + struct VertexDescriptionInputs + { + float3 ObjectSpaceNormal; + float3 ObjectSpaceTangent; + float3 ObjectSpacePosition; + }; + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float4 interp0 : INTERP0; + float4 interp1 : INTERP1; + float4 interp2 : INTERP2; + float4 interp3 : INTERP3; + float4 interp4 : INTERP4; + #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 + }; + + PackedVaryings PackVaryings (Varyings input) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + output.positionCS = input.positionCS; + output.interp0.xyzw = input.texCoord0; + output.interp1.xyzw = input.texCoord1; + output.interp2.xyzw = input.texCoord2; + output.interp3.xyzw = input.texCoord3; + output.interp4.xyzw = input.color; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + Varyings UnpackVaryings (PackedVaryings input) + { + Varyings output; + output.positionCS = input.positionCS; + output.texCoord0 = input.interp0.xyzw; + output.texCoord1 = input.interp1.xyzw; + output.texCoord2 = input.interp2.xyzw; + output.texCoord3 = input.interp3.xyzw; + output.color = input.interp4.xyzw; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + + // -------------------------------------------------- + // Graph + + // Graph Properties + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_TexelSize; + float2 _OutlineOffset1; + float2 _OutlineOffset2; + float2 _OutlineOffset3; + float _GradientScale; + float4 _FaceColor; + float4 _IsoPerimeter; + float4 _OutlineColor1; + float4 _OutlineColor2; + float4 _OutlineColor3; + float _OutlineMode; + float3 _Softness; + float4 _FaceTex_TexelSize; + float2 _FaceUVSpeed; + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + float2 _OutlineUVSpeed; + float4 _UnderlayColor; + float2 _UnderlayOffset; + float _UnderlayDilate; + float _UnderlaySoftness; + float _BevelType; + float _BevelAmount; + float _BevelOffset; + float _BevelWidth; + float _BevelRoundness; + float _BevelClamp; + float4 _SpecularColor; + float _LightAngle; + float _SpecularPower; + float _Reflectivity; + float _Diffuse; + float _Ambient; + float4 _OutlineTex_TexelSize; + float _ScaleRatioA; + float4 Emissive; + float _smoothness; + float _Metalic; + CBUFFER_END + + // Object and Global properties + SAMPLER(SamplerState_Linear_Repeat); + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + TEXTURE2D(_FaceTex); + SAMPLER(sampler_FaceTex); + SAMPLER(SamplerState_Linear_Clamp); + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + + // Graph Includes + #include "Assets/TextMesh Pro/Shaders/SDFFunctions.hlsl" + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + // Graph Functions + + void Unity_Combine_float(float R, float G, float B, float A, out float4 RGBA, out float3 RGB, out float2 RG) + { + RGBA = float4(R, G, B, A); + RGB = float3(R, G, B); + RG = float2(R, G); + } + + void Unity_Divide_float4(float4 A, float4 B, out float4 Out) + { + Out = A / B; + } + + void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out) + { + Out = A * B; + } + + void Unity_Subtract_float2(float2 A, float2 B, out float2 Out) + { + Out = A - B; + } + + void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out) + { + Out = A * B; + } + + // Custom interpolators pre vertex + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */ + + // Graph Vertex + struct VertexDescription + { + float3 Position; + float3 Normal; + float3 Tangent; + }; + + VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN) + { + VertexDescription description = (VertexDescription)0; + description.Position = IN.ObjectSpacePosition; + description.Normal = IN.ObjectSpaceNormal; + description.Tangent = IN.ObjectSpaceTangent; + return description; + } + + // Custom interpolators, pre surface + #ifdef FEATURES_GRAPH_VERTEX + Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input) + { + return output; + } + #define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC + #endif + + // Graph Pixel + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) + { + SurfaceDescription surface = (SurfaceDescription)0; + float4 _UV_533a59502f0abc8bb2c09828f32ebead_Out_0 = IN.uv0; + UnityTexture2D _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.z; + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Height_2 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.w; + float _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3; + ScreenSpaceRatio_float((_UV_533a59502f0abc8bb2c09828f32ebead_Out_0.xy), _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0, 0, _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3); + UnityTexture2D _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(IN.uv0.xy)); + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_R_4 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.r; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_G_5 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.g; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_B_6 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.b; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.a; + float4 _UV_b26868a97b712882abeca1b58698beb0_Out_0 = IN.uv0; + float2 _Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0 = _OutlineOffset1; + float _Property_c650c0154e947e898564d7d1d007d48e_Out_0 = _GradientScale; + UnityTexture2D _Property_6e377359c1349380b9482e9613fcec6b_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.z; + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.w; + float4 _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4; + float3 _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5; + float2 _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6; + Unity_Combine_float(_TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0, _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2, 0, 0, _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5, _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6); + float4 _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2; + Unity_Divide_float4((_Property_c650c0154e947e898564d7d1d007d48e_Out_0.xxxx), _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2); + float2 _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2; + Unity_Multiply_float2_float2(_Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2); + float2 _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2, _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2); + float4 _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_8ecda3d29d47068e8b76538959fab084_Out_2)); + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_R_4 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.r; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_G_5 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.g; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_B_6 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.b; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.a; + float2 _Property_5a3269796f550283a99abee895aeedd4_Out_0 = _OutlineOffset2; + float2 _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2; + Unity_Multiply_float2_float2((_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Property_5a3269796f550283a99abee895aeedd4_Out_0, _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2); + float2 _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2, _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2); + float4 _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2)); + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_R_4 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.r; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_G_5 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.g; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_B_6 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.b; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.a; + float2 _Property_20cbcbce438f6581847bd3da66673af8_Out_0 = _OutlineOffset3; + float2 _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2; + Unity_Multiply_float2_float2(_Property_20cbcbce438f6581847bd3da66673af8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2); + float2 _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2, _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2); + float4 _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2)); + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_R_4 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.r; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_G_5 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.g; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_B_6 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.b; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.a; + float4 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4; + float3 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5; + float2 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6; + Unity_Combine_float(_SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7, _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7, _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7, _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6); + float _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0 = _GradientScale; + float4 _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0 = _IsoPerimeter; + float3 _Property_05d545af6f7ff08387320e1130c67389_Out_0 = _Softness; + float _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0 = _OutlineMode; + float4 _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6; + ComputeSDF44_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0, _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0, (float4(_Property_05d545af6f7ff08387320e1130c67389_Out_0, 1.0)), _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0, _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6); + float4 _Property_eaed1eca838e7183ae708f9502a50dba_Out_0 = _FaceColor; + UnityTexture2D _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0 = UnityBuildTexture2DStructNoScale(_FaceTex); + float4 _UV_90e11fefcc71b18b8d88b417548d224f_Out_0 = IN.uv0; + float4 _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0 = _FaceTex_ST; + float2 _Property_ced4707a1339568eb002c789407f8a3b_Out_0 = _FaceUVSpeed; + float2 _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3; + GenerateUV_float((_UV_90e11fefcc71b18b8d88b417548d224f_Out_0.xy), _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0, _Property_ced4707a1339568eb002c789407f8a3b_Out_0, _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3); + float4 _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.tex, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.samplerstate, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.GetTransformedUV(_GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3)); + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_R_4 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.r; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_G_5 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.g; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_B_6 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.b; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_A_7 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.a; + float4 _Multiply_48133834a18f14828ac11b58bc205702_Out_2; + Unity_Multiply_float4_float4(_Property_eaed1eca838e7183ae708f9502a50dba_Out_0, _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0, _Multiply_48133834a18f14828ac11b58bc205702_Out_2); + float4 _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2; + Unity_Multiply_float4_float4(IN.VertexColor, _Multiply_48133834a18f14828ac11b58bc205702_Out_2, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2); + float4 _Property_4637336160f04f8397ca8f3b6531e88e_Out_0 = _OutlineColor1; + UnityTexture2D _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0 = UnityBuildTexture2DStructNoScale(_OutlineTex); + float4 _UV_343788cf38e6598db275321a22b05984_Out_0 = IN.uv0; + float4 _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0 = _OutlineTex_ST; + float2 _Property_11ca84fc4adc63868541229e4f404eae_Out_0 = _OutlineUVSpeed; + float2 _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3; + GenerateUV_float((_UV_343788cf38e6598db275321a22b05984_Out_0.xy), _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0, _Property_11ca84fc4adc63868541229e4f404eae_Out_0, _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3); + float4 _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.tex, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.samplerstate, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.GetTransformedUV(_GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3)); + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_R_4 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.r; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_G_5 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.g; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_B_6 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.b; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_A_7 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.a; + float4 _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2; + Unity_Multiply_float4_float4(_Property_4637336160f04f8397ca8f3b6531e88e_Out_0, _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2); + float4 _Property_6e8acbed3933c6819383cb89fe70a942_Out_0 = _OutlineColor2; + float2 _Property_baa8c75173022e86bde4cc075585af43_Out_0 = _OutlineOffset3; + float4 _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5; + Layer4_float(_ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2, _Property_6e8acbed3933c6819383cb89fe70a942_Out_0, (float4(_Property_baa8c75173022e86bde4cc075585af43_Out_0, 0.0, 1.0)), _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5); + UnityTexture2D _Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + UnityTexture2D _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_abc928409a963289955625c60e3c3674_Width_0 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.z; + float _TexelSize_abc928409a963289955625c60e3c3674_Height_2 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.w; + float4 _UV_7afe81a63629c789aece6cf7ed368769_Out_0 = IN.uv0; + float _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0 = max(0, IN.FaceSign.x); + float3 _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5; + GetSurfaceNormal_float(_Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0.tex, _TexelSize_abc928409a963289955625c60e3c3674_Width_0, _TexelSize_abc928409a963289955625c60e3c3674_Height_2, (_UV_7afe81a63629c789aece6cf7ed368769_Out_0).x, _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5); + float4 _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2; + EvaluateLight_float(_Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5, _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2); + UnityTexture2D _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _UV_87b50231796c43898a28be7b2f8daea3_Out_0 = IN.uv0; + float2 _Property_c20a130451687b8c87b5a623d8ca6d73_Out_0 = _UnderlayOffset; + float2 _Multiply_7d754a30a319c9839ca945e596548e63_Out_2; + Unity_Multiply_float2_float2(_Property_c20a130451687b8c87b5a623d8ca6d73_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2); + float2 _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2; + Unity_Subtract_float2((_UV_87b50231796c43898a28be7b2f8daea3_Out_0.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2, _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2); + float4 _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0 = SAMPLE_TEXTURE2D(_Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.tex, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.samplerstate, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.GetTransformedUV(_Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2)); + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_R_4 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.r; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_G_5 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.g; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_B_6 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.b; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_A_7 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.a; + float _Property_cb906f6db0fb388a91590590b04091ab_Out_0 = _GradientScale; + float _Property_22272afe5996178386aac669fbda451b_Out_0 = _UnderlayDilate; + float _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0 = _UnderlaySoftness; + float _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0; + ComputeSDF_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, (_SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0).x, _Property_cb906f6db0fb388a91590590b04091ab_Out_0, _Property_22272afe5996178386aac669fbda451b_Out_0, _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0, _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0); + float4 _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0 = _UnderlayColor; + float4 _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2; + Layer1_float(_ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0, _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2); + float4 _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2; + Composite_float(_EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2, _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2); + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_R_1 = IN.VertexColor[0]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_G_2 = IN.VertexColor[1]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_B_3 = IN.VertexColor[2]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4 = IN.VertexColor[3]; + float4 _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2; + Unity_Multiply_float4_float4(_CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2, (_Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4.xxxx), _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2); + float _Split_9b3e8141df129b848c4c1b364b613b86_R_1 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[0]; + float _Split_9b3e8141df129b848c4c1b364b613b86_G_2 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[1]; + float _Split_9b3e8141df129b848c4c1b364b613b86_B_3 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[2]; + float _Split_9b3e8141df129b848c4c1b364b613b86_A_4 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[3]; + surface.Alpha = _Split_9b3e8141df129b848c4c1b364b613b86_A_4; + surface.AlphaClipThreshold = 0.5; + return surface; + } + + // -------------------------------------------------- + // Build Graph Inputs + #ifdef HAVE_VFX_MODIFICATION + #define VFX_SRP_ATTRIBUTES Attributes + #define VFX_SRP_VARYINGS Varyings + #define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs + #endif + VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input) + { + VertexDescriptionInputs output; + ZERO_INITIALIZE(VertexDescriptionInputs, output); + + output.ObjectSpaceNormal = input.normalOS; + output.ObjectSpaceTangent = input.tangentOS.xyz; + output.ObjectSpacePosition = input.positionOS; + + return output; + } + SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) + { + SurfaceDescriptionInputs output; + ZERO_INITIALIZE(SurfaceDescriptionInputs, output); + + #ifdef HAVE_VFX_MODIFICATION + // FragInputs from VFX come from two places: Interpolator or CBuffer. + /* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */ + + #endif + + + + + + + + output.uv0 = input.texCoord0; + output.uv1 = input.texCoord1; + output.uv2 = input.texCoord2; + output.uv3 = input.texCoord3; + output.VertexColor = input.color; + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false); + #else + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #endif + BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + + return output; + } + + // -------------------------------------------------- + // Main + + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/SelectionPickingPass.hlsl" + + // -------------------------------------------------- + // Visual Effect Vertex Invocations + #ifdef HAVE_VFX_MODIFICATION + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl" + #endif + + ENDHLSL + } + Pass + { + // Name: + Tags + { + "LightMode" = "Universal2D" + } + + // Render State + Cull Off + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + + // Debug + // + + // -------------------------------------------------- + // Pass + + HLSLPROGRAM + + // Pragmas + #pragma target 4.5 + #pragma exclude_renderers gles gles3 glcore + #pragma vertex vert + #pragma fragment frag + + // DotsInstancingOptions: + // HybridV1InjectedBuiltinProperties: + + // Keywords + // PassKeywords: + // GraphKeywords: + + // Defines + + #define _NORMALMAP 1 + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define ATTRIBUTES_NEED_TEXCOORD3 + #define ATTRIBUTES_NEED_COLOR + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_TEXCOORD1 + #define VARYINGS_NEED_TEXCOORD2 + #define VARYINGS_NEED_TEXCOORD3 + #define VARYINGS_NEED_COLOR + #define VARYINGS_NEED_CULLFACE + #define FEATURES_GRAPH_VERTEX + /* WARNING: $splice Could not find named fragment 'PassInstancing' */ + #define SHADERPASS SHADERPASS_2D + #define _ALPHATEST_ON 1 + /* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */ + + + // custom interpolator pre-include + /* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */ + + // 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/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + // -------------------------------------------------- + // Structs and Packing + + // custom interpolators pre packing + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */ + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + float4 uv3 : TEXCOORD3; + float4 color : COLOR; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : INSTANCEID_SEMANTIC; + #endif + }; + struct Varyings + { + float4 positionCS : SV_POSITION; + float4 texCoord0; + float4 texCoord1; + float4 texCoord2; + float4 texCoord3; + float4 color; + #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 + }; + struct SurfaceDescriptionInputs + { + float4 uv0; + float4 uv1; + float4 uv2; + float4 uv3; + float4 VertexColor; + float FaceSign; + }; + struct VertexDescriptionInputs + { + float3 ObjectSpaceNormal; + float3 ObjectSpaceTangent; + float3 ObjectSpacePosition; + }; + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float4 interp0 : INTERP0; + float4 interp1 : INTERP1; + float4 interp2 : INTERP2; + float4 interp3 : INTERP3; + float4 interp4 : INTERP4; + #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 + }; + + PackedVaryings PackVaryings (Varyings input) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + output.positionCS = input.positionCS; + output.interp0.xyzw = input.texCoord0; + output.interp1.xyzw = input.texCoord1; + output.interp2.xyzw = input.texCoord2; + output.interp3.xyzw = input.texCoord3; + output.interp4.xyzw = input.color; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + Varyings UnpackVaryings (PackedVaryings input) + { + Varyings output; + output.positionCS = input.positionCS; + output.texCoord0 = input.interp0.xyzw; + output.texCoord1 = input.interp1.xyzw; + output.texCoord2 = input.interp2.xyzw; + output.texCoord3 = input.interp3.xyzw; + output.color = input.interp4.xyzw; + #if UNITY_ANY_INSTANCING_ENABLED + output.instanceID = input.instanceID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + output.cullFace = input.cullFace; + #endif + return output; + } + + + // -------------------------------------------------- + // Graph + + // Graph Properties + CBUFFER_START(UnityPerMaterial) + float4 _MainTex_TexelSize; + float2 _OutlineOffset1; + float2 _OutlineOffset2; + float2 _OutlineOffset3; + float _GradientScale; + float4 _FaceColor; + float4 _IsoPerimeter; + float4 _OutlineColor1; + float4 _OutlineColor2; + float4 _OutlineColor3; + float _OutlineMode; + float3 _Softness; + float4 _FaceTex_TexelSize; + float2 _FaceUVSpeed; + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + float2 _OutlineUVSpeed; + float4 _UnderlayColor; + float2 _UnderlayOffset; + float _UnderlayDilate; + float _UnderlaySoftness; + float _BevelType; + float _BevelAmount; + float _BevelOffset; + float _BevelWidth; + float _BevelRoundness; + float _BevelClamp; + float4 _SpecularColor; + float _LightAngle; + float _SpecularPower; + float _Reflectivity; + float _Diffuse; + float _Ambient; + float4 _OutlineTex_TexelSize; + float _ScaleRatioA; + float4 Emissive; + float _smoothness; + float _Metalic; + CBUFFER_END + + // Object and Global properties + SAMPLER(SamplerState_Linear_Repeat); + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + TEXTURE2D(_FaceTex); + SAMPLER(sampler_FaceTex); + SAMPLER(SamplerState_Linear_Clamp); + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + + // Graph Includes + #include "Assets/TextMesh Pro/Shaders/SDFFunctions.hlsl" + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + // Graph Functions + + void Unity_Combine_float(float R, float G, float B, float A, out float4 RGBA, out float3 RGB, out float2 RG) + { + RGBA = float4(R, G, B, A); + RGB = float3(R, G, B); + RG = float2(R, G); + } + + void Unity_Divide_float4(float4 A, float4 B, out float4 Out) + { + Out = A / B; + } + + void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out) + { + Out = A * B; + } + + void Unity_Subtract_float2(float2 A, float2 B, out float2 Out) + { + Out = A - B; + } + + void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out) + { + Out = A * B; + } + + // Custom interpolators pre vertex + /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */ + + // Graph Vertex + struct VertexDescription + { + float3 Position; + float3 Normal; + float3 Tangent; + }; + + VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN) + { + VertexDescription description = (VertexDescription)0; + description.Position = IN.ObjectSpacePosition; + description.Normal = IN.ObjectSpaceNormal; + description.Tangent = IN.ObjectSpaceTangent; + return description; + } + + // Custom interpolators, pre surface + #ifdef FEATURES_GRAPH_VERTEX + Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input) + { + return output; + } + #define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC + #endif + + // Graph Pixel + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + float AlphaClipThreshold; + }; + + SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) + { + SurfaceDescription surface = (SurfaceDescription)0; + float4 _UV_533a59502f0abc8bb2c09828f32ebead_Out_0 = IN.uv0; + UnityTexture2D _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.z; + float _TexelSize_389f09eeac16ed8eb7a6151195af0507_Height_2 = _Property_1fe43c50e88d8d82b3ef889f12dcfb65_Out_0.texelSize.w; + float _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3; + ScreenSpaceRatio_float((_UV_533a59502f0abc8bb2c09828f32ebead_Out_0.xy), _TexelSize_389f09eeac16ed8eb7a6151195af0507_Width_0, 0, _ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3); + UnityTexture2D _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(IN.uv0.xy)); + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_R_4 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.r; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_G_5 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.g; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_B_6 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.b; + float _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7 = _SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_RGBA_0.a; + float4 _UV_b26868a97b712882abeca1b58698beb0_Out_0 = IN.uv0; + float2 _Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0 = _OutlineOffset1; + float _Property_c650c0154e947e898564d7d1d007d48e_Out_0 = _GradientScale; + UnityTexture2D _Property_6e377359c1349380b9482e9613fcec6b_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.z; + float _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2 = _Property_6e377359c1349380b9482e9613fcec6b_Out_0.texelSize.w; + float4 _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4; + float3 _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5; + float2 _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6; + Unity_Combine_float(_TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Width_0, _TexelSize_50a5d2cfcb0fb5868c2afda9bcb48dc7_Height_2, 0, 0, _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Combine_fd0cd2353f78958d948ad3086c76645e_RGB_5, _Combine_fd0cd2353f78958d948ad3086c76645e_RG_6); + float4 _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2; + Unity_Divide_float4((_Property_c650c0154e947e898564d7d1d007d48e_Out_0.xxxx), _Combine_fd0cd2353f78958d948ad3086c76645e_RGBA_4, _Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2); + float2 _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2; + Unity_Multiply_float2_float2(_Property_e4fdf31842293c8fb0a7eb85f924b8b8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2); + float2 _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_9af20166c7f70c88a2d4c144834f02e5_Out_2, _Subtract_8ecda3d29d47068e8b76538959fab084_Out_2); + float4 _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_8ecda3d29d47068e8b76538959fab084_Out_2)); + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_R_4 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.r; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_G_5 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.g; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_B_6 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.b; + float _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7 = _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_RGBA_0.a; + float2 _Property_5a3269796f550283a99abee895aeedd4_Out_0 = _OutlineOffset2; + float2 _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2; + Unity_Multiply_float2_float2((_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Property_5a3269796f550283a99abee895aeedd4_Out_0, _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2); + float2 _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_85a4a1da71c88a8aa9cf834b093b4972_Out_2, _Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2); + float4 _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_02ec11df97f0828fb90fe51bc7b54681_Out_2)); + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_R_4 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.r; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_G_5 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.g; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_B_6 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.b; + float _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7 = _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_RGBA_0.a; + float2 _Property_20cbcbce438f6581847bd3da66673af8_Out_0 = _OutlineOffset3; + float2 _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2; + Unity_Multiply_float2_float2(_Property_20cbcbce438f6581847bd3da66673af8_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2); + float2 _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2; + Unity_Subtract_float2((_UV_b26868a97b712882abeca1b58698beb0_Out_0.xy), _Multiply_25810e5a76f1a28eb6ec31562b2826f7_Out_2, _Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2); + float4 _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0 = SAMPLE_TEXTURE2D(_Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.tex, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.samplerstate, _Property_954c72ffa0c26f869fe03d926f8a55be_Out_0.GetTransformedUV(_Subtract_35bf56304ae79a858535fc1f6d2bb434_Out_2)); + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_R_4 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.r; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_G_5 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.g; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_B_6 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.b; + float _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7 = _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_RGBA_0.a; + float4 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4; + float3 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5; + float2 _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6; + Unity_Combine_float(_SampleTexture2D_c7724e68891dfd8fb3f6f6438d260c7e_A_7, _SampleTexture2D_6eff60a2fbddd98c88812ff580f90b76_A_7, _SampleTexture2D_2ecc410c1f24678bb1f0bf27189d4db2_A_7, _SampleTexture2D_ff6dd86b2d329e848816a50765c58716_A_7, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGB_5, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RG_6); + float _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0 = _GradientScale; + float4 _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0 = _IsoPerimeter; + float3 _Property_05d545af6f7ff08387320e1130c67389_Out_0 = _Softness; + float _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0 = _OutlineMode; + float4 _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6; + ComputeSDF44_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, _Combine_a777dc93e8ca248cb6fe690cc4a77a5a_RGBA_4, _Property_bdf7e7b4670fdc86a20f193fb041efd3_Out_0, _Property_f5d0374e48ad748a9e62658056ab81a3_Out_0, (float4(_Property_05d545af6f7ff08387320e1130c67389_Out_0, 1.0)), _Property_ab4e94278c3a0b8eba9ceccb7822f574_Out_0, _ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6); + float4 _Property_eaed1eca838e7183ae708f9502a50dba_Out_0 = _FaceColor; + UnityTexture2D _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0 = UnityBuildTexture2DStructNoScale(_FaceTex); + float4 _UV_90e11fefcc71b18b8d88b417548d224f_Out_0 = IN.uv0; + float4 _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0 = _FaceTex_ST; + float2 _Property_ced4707a1339568eb002c789407f8a3b_Out_0 = _FaceUVSpeed; + float2 _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3; + GenerateUV_float((_UV_90e11fefcc71b18b8d88b417548d224f_Out_0.xy), _Property_26b98e8b908b638d92c1cf36c28e2c9f_Out_0, _Property_ced4707a1339568eb002c789407f8a3b_Out_0, _GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3); + float4 _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.tex, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.samplerstate, _Property_8be90b40fe8d878fb21c1cc890b86378_Out_0.GetTransformedUV(_GenerateUVCustomFunction_31c71b52d27c2b86a20c03f7256c5fa5_UV_3)); + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_R_4 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.r; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_G_5 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.g; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_B_6 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.b; + float _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_A_7 = _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0.a; + float4 _Multiply_48133834a18f14828ac11b58bc205702_Out_2; + Unity_Multiply_float4_float4(_Property_eaed1eca838e7183ae708f9502a50dba_Out_0, _SampleTexture2D_c882f19d0ae7ed87b310a0d75334a39f_RGBA_0, _Multiply_48133834a18f14828ac11b58bc205702_Out_2); + float4 _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2; + Unity_Multiply_float4_float4(IN.VertexColor, _Multiply_48133834a18f14828ac11b58bc205702_Out_2, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2); + float4 _Property_4637336160f04f8397ca8f3b6531e88e_Out_0 = _OutlineColor1; + UnityTexture2D _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0 = UnityBuildTexture2DStructNoScale(_OutlineTex); + float4 _UV_343788cf38e6598db275321a22b05984_Out_0 = IN.uv0; + float4 _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0 = _OutlineTex_ST; + float2 _Property_11ca84fc4adc63868541229e4f404eae_Out_0 = _OutlineUVSpeed; + float2 _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3; + GenerateUV_float((_UV_343788cf38e6598db275321a22b05984_Out_0.xy), _Property_f5b7ef749a5e5a80911752b8c751465e_Out_0, _Property_11ca84fc4adc63868541229e4f404eae_Out_0, _GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3); + float4 _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.tex, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.samplerstate, _Property_dae1c5bdd7aa6687b1cd165feffd5710_Out_0.GetTransformedUV(_GenerateUVCustomFunction_dadb37f57181a4829003e40234b9d409_UV_3)); + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_R_4 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.r; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_G_5 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.g; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_B_6 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.b; + float _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_A_7 = _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0.a; + float4 _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2; + Unity_Multiply_float4_float4(_Property_4637336160f04f8397ca8f3b6531e88e_Out_0, _SampleTexture2D_44ec75290e3e9b8fbcf92c999d6ac8bc_RGBA_0, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2); + float4 _Property_6e8acbed3933c6819383cb89fe70a942_Out_0 = _OutlineColor2; + float2 _Property_baa8c75173022e86bde4cc075585af43_Out_0 = _OutlineOffset3; + float4 _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5; + Layer4_float(_ComputeSDF44CustomFunction_13b6209c286745868057a70fce31d5e1_Alpha_6, _Multiply_223ab9ae77672a8798690299a6dae4bd_Out_2, _Multiply_8d7e7fd5eca24b8db946e4e5a4968f70_Out_2, _Property_6e8acbed3933c6819383cb89fe70a942_Out_0, (float4(_Property_baa8c75173022e86bde4cc075585af43_Out_0, 0.0, 1.0)), _Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5); + UnityTexture2D _Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + UnityTexture2D _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float _TexelSize_abc928409a963289955625c60e3c3674_Width_0 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.z; + float _TexelSize_abc928409a963289955625c60e3c3674_Height_2 = _Property_1744832cec65fb85a42db2e1d9cdff97_Out_0.texelSize.w; + float4 _UV_7afe81a63629c789aece6cf7ed368769_Out_0 = IN.uv0; + float _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0 = max(0, IN.FaceSign.x); + float3 _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5; + GetSurfaceNormal_float(_Property_5b0219fd9b23c785b6053d92dc125ed9_Out_0.tex, _TexelSize_abc928409a963289955625c60e3c3674_Width_0, _TexelSize_abc928409a963289955625c60e3c3674_Height_2, (_UV_7afe81a63629c789aece6cf7ed368769_Out_0).x, _IsFrontFace_33ef6b7d7f95818ba696de9dae14e559_Out_0, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5); + float4 _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2; + EvaluateLight_float(_Layer4CustomFunction_ab624c3948e3a08ab05aef05a98eb8f7_RGBA_5, _GetSurfaceNormalCustomFunction_27813c88a9458283b1866c0fcdaf259a_New5_5, _EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2); + UnityTexture2D _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex); + float4 _UV_87b50231796c43898a28be7b2f8daea3_Out_0 = IN.uv0; + float2 _Property_c20a130451687b8c87b5a623d8ca6d73_Out_0 = _UnderlayOffset; + float2 _Multiply_7d754a30a319c9839ca945e596548e63_Out_2; + Unity_Multiply_float2_float2(_Property_c20a130451687b8c87b5a623d8ca6d73_Out_0, (_Divide_5e0d454c5ea95b88a8f414c16e1bf059_Out_2.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2); + float2 _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2; + Unity_Subtract_float2((_UV_87b50231796c43898a28be7b2f8daea3_Out_0.xy), _Multiply_7d754a30a319c9839ca945e596548e63_Out_2, _Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2); + float4 _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0 = SAMPLE_TEXTURE2D(_Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.tex, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.samplerstate, _Property_3407a26c1e2b438ab594b42c3b95454e_Out_0.GetTransformedUV(_Subtract_ebbd2e0341529d80a91e0d0893b6ee73_Out_2)); + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_R_4 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.r; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_G_5 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.g; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_B_6 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.b; + float _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_A_7 = _SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0.a; + float _Property_cb906f6db0fb388a91590590b04091ab_Out_0 = _GradientScale; + float _Property_22272afe5996178386aac669fbda451b_Out_0 = _UnderlayDilate; + float _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0 = _UnderlaySoftness; + float _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0; + ComputeSDF_float(_ScreenSpaceRatioCustomFunction_eef499a7036c138e9121e5151cdb5be1_New3_3, (_SampleTexture2D_fe4f97a213ae1d8aa48bfc4f1aa17fa9_RGBA_0).x, _Property_cb906f6db0fb388a91590590b04091ab_Out_0, _Property_22272afe5996178386aac669fbda451b_Out_0, _Property_1cd799c4097e1685b9dbf5dd80b6062b_Out_0, _ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0); + float4 _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0 = _UnderlayColor; + float4 _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2; + Layer1_float(_ComputeSDFCustomFunction_cb33c8373e2fb98da278a4b6f9bab088_Alpha_0, _Property_4be3e1d3be22b78f9f4e23b78e8d6064_Out_0, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2); + float4 _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2; + Composite_float(_EvaluateLightCustomFunction_cd74ed92b44ab58b95bf81cf4664fa77_Color_2, _Layer1CustomFunction_58efba96e643d281ba7d757bc713ff15_RGBA_2, _CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2); + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_R_1 = IN.VertexColor[0]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_G_2 = IN.VertexColor[1]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_B_3 = IN.VertexColor[2]; + float _Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4 = IN.VertexColor[3]; + float4 _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2; + Unity_Multiply_float4_float4(_CompositeCustomFunction_7e22b933a6629e8389cf370acfd80658_RGBA_2, (_Split_79de04ac9d55bc8693a6a09c54eed8bb_A_4.xxxx), _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2); + float _Split_9b3e8141df129b848c4c1b364b613b86_R_1 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[0]; + float _Split_9b3e8141df129b848c4c1b364b613b86_G_2 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[1]; + float _Split_9b3e8141df129b848c4c1b364b613b86_B_3 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[2]; + float _Split_9b3e8141df129b848c4c1b364b613b86_A_4 = _Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2[3]; + surface.BaseColor = (_Multiply_17b5e496d42b5d89b09b1763aa47bb78_Out_2.xyz); + surface.Alpha = _Split_9b3e8141df129b848c4c1b364b613b86_A_4; + surface.AlphaClipThreshold = 0.5; + return surface; + } + + // -------------------------------------------------- + // Build Graph Inputs + #ifdef HAVE_VFX_MODIFICATION + #define VFX_SRP_ATTRIBUTES Attributes + #define VFX_SRP_VARYINGS Varyings + #define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs + #endif + VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input) + { + VertexDescriptionInputs output; + ZERO_INITIALIZE(VertexDescriptionInputs, output); + + output.ObjectSpaceNormal = input.normalOS; + output.ObjectSpaceTangent = input.tangentOS.xyz; + output.ObjectSpacePosition = input.positionOS; + + return output; + } + SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) + { + SurfaceDescriptionInputs output; + ZERO_INITIALIZE(SurfaceDescriptionInputs, output); + + #ifdef HAVE_VFX_MODIFICATION + // FragInputs from VFX come from two places: Interpolator or CBuffer. + /* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */ + + #endif + + + + + + + + output.uv0 = input.texCoord0; + output.uv1 = input.texCoord1; + output.uv2 = input.texCoord2; + output.uv3 = input.texCoord3; + output.VertexColor = input.color; + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false); + #else + #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #endif + BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + #undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN + + return output; + } + + // -------------------------------------------------- + // Main + + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/PBR2DPass.hlsl" + + // -------------------------------------------------- + // Visual Effect Vertex Invocations + #ifdef HAVE_VFX_MODIFICATION + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl" + #endif + + ENDHLSL + } + } + CustomEditorForRenderPipeline "UnityEditor.ShaderGraphLitGUI" "UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset" + CustomEditor "UnityEditor.ShaderGraph.GenericShaderGraphMaterialGUI" + FallBack "Hidden/Shader Graph/FallbackError" +} \ No newline at end of file diff --git a/Assets/SLZShaders/TMP_SDF-URP Lit Baked.shader.meta b/Assets/SLZShaders/TMP_SDF-URP Lit Baked.shader.meta new file mode 100644 index 0000000..a88072c --- /dev/null +++ b/Assets/SLZShaders/TMP_SDF-URP Lit Baked.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 93a4eb99edd7b9c42bfb913f0ee52b3e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Textures.meta b/Assets/SLZShaders/Textures.meta new file mode 100644 index 0000000..1ebcb0e --- /dev/null +++ b/Assets/SLZShaders/Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ca296f3d7b22feb4e81db6271c2350cf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Textures/BloodyHitRamp.png b/Assets/SLZShaders/Textures/BloodyHitRamp.png new file mode 100644 index 0000000..50ccc9a Binary files /dev/null and b/Assets/SLZShaders/Textures/BloodyHitRamp.png differ diff --git a/Assets/SLZShaders/Textures/BloodyHitRamp.png.meta b/Assets/SLZShaders/Textures/BloodyHitRamp.png.meta new file mode 100644 index 0000000..b614166 --- /dev/null +++ b/Assets/SLZShaders/Textures/BloodyHitRamp.png.meta @@ -0,0 +1,138 @@ +fileFormatVersion: 2 +guid: c96b15076e0088349a95505e52f5a12a +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 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 2 + mipBias: 0 + wrapU: 1 + 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 + 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: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 51 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + 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: "\r\n\r\n + false\r\n true\r\n + GenRoughness\r\n 1\r\n + false\r\n" + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Textures/Pixels_crt-01.png b/Assets/SLZShaders/Textures/Pixels_crt-01.png new file mode 100644 index 0000000..12c9532 Binary files /dev/null and b/Assets/SLZShaders/Textures/Pixels_crt-01.png differ diff --git a/Assets/SLZShaders/Textures/Pixels_crt-01.png.meta b/Assets/SLZShaders/Textures/Pixels_crt-01.png.meta new file mode 100644 index 0000000..f7dfab4 --- /dev/null +++ b/Assets/SLZShaders/Textures/Pixels_crt-01.png.meta @@ -0,0 +1,126 @@ +fileFormatVersion: 2 +guid: 81cc8fbe3bd52d149b2b91936b92bfb8 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 1 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 5 + mipMapFadeDistanceEnd: 8 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + 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 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 128 + resizeAlgorithm: 1 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 128 + resizeAlgorithm: 1 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 128 + resizeAlgorithm: 1 + textureFormat: 51 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + 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: "\r\n\r\n + false\r\n true\r\n + GenRoughness\r\n 1\r\n + false\r\n" + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Textures/ToonRamp_SSS_strokes_Cleaned.psd b/Assets/SLZShaders/Textures/ToonRamp_SSS_strokes_Cleaned.psd new file mode 100644 index 0000000..401e644 Binary files /dev/null and b/Assets/SLZShaders/Textures/ToonRamp_SSS_strokes_Cleaned.psd differ diff --git a/Assets/SLZShaders/Textures/ToonRamp_SSS_strokes_Cleaned.psd.meta b/Assets/SLZShaders/Textures/ToonRamp_SSS_strokes_Cleaned.psd.meta new file mode 100644 index 0000000..e6d7046 --- /dev/null +++ b/Assets/SLZShaders/Textures/ToonRamp_SSS_strokes_Cleaned.psd.meta @@ -0,0 +1,138 @@ +fileFormatVersion: 2 +guid: 6dc78741d54741a4c90a0fb74bd75f20 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + 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: 1 + 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: 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 + 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: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: "\r\n\r\n + false\r\n true\r\n + GenRoughness\r\n 1\r\n + false\r\n" + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/Textures/metalHitRamp.png b/Assets/SLZShaders/Textures/metalHitRamp.png new file mode 100644 index 0000000..eda107e Binary files /dev/null and b/Assets/SLZShaders/Textures/metalHitRamp.png differ diff --git a/Assets/SLZShaders/Textures/metalHitRamp.png.meta b/Assets/SLZShaders/Textures/metalHitRamp.png.meta new file mode 100644 index 0000000..69c900b --- /dev/null +++ b/Assets/SLZShaders/Textures/metalHitRamp.png.meta @@ -0,0 +1,126 @@ +fileFormatVersion: 2 +guid: 93c33570d60341c439e50150832c5173 +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 + 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: 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 + 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: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 51 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + 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: "\r\n\r\n + false\r\n true\r\n + GenRoughness\r\n 1\r\n + false\r\n" + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/VR_MotionVectorLit.shader b/Assets/SLZShaders/VR_MotionVectorLit.shader new file mode 100644 index 0000000..86bf5a7 --- /dev/null +++ b/Assets/SLZShaders/VR_MotionVectorLit.shader @@ -0,0 +1,3465 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/Motion Vector Lit" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) + [ASEBegin][NoScaleOffset]_MainTex("Base Map", 2D) = "white" {} + [NoScaleOffset][Normal]_BumpMap("Bump Map", 2D) = "bump" {} + [NoScaleOffset]_MetallicGlossMap("MAS", 2D) = "white" {} + [NoScaleOffset]_MotionVectors("Motion Vectors", 2D) = "white" {} + _UVMotionMultiplier("UV Motion Multiplier", Float) = 0 + [HDR]_Color("Color", Color) = (1,1,1,1) + _Rows("Rows", Int) = 4 + _Columns("Columns", Int) = 8 + [ASEEnd]_Framerate("Framerate", Float) = 30 + + [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) = "" {} + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + + + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" } + Cull Back + ZWrite On + ZTest LEqual + Offset 0 , 0 + AlphaToMask Off + + HLSLINCLUDE + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForward" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_FORWARD + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.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.core/ShaderLibrary/TextureStack.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.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.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_color : COLOR; + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_MainTex); + TEXTURE2D(_MotionVectors); + SAMPLER(sampler_MotionVectors); + SAMPLER(sampler_MainTex); + TEXTURE2D(_BumpMap); + SAMPLER(sampler_BumpMap); + TEXTURE2D(_MetallicGlossMap); + SAMPLER(sampler_MetallicGlossMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_color = v.ase_color; + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + #endif + + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) || defined(ASE_TERRAIN_INSTANCING) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + o.ase_color = v.ase_color; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 texCoord87 = IN.ase_texcoord8.xy * float2( 1,1 ) + float2( 0,0 ); + float2 appendResult109 = (float2((float)_Columns , (float)_Rows)); + float2 temp_output_110_0 = ( texCoord87 / appendResult109 ); + float mulTime126 = _TimeParameters.x * _Framerate; + float temp_output_97_0 = ( floor( mulTime126 ) / _Columns ); + float2 appendResult112 = (float2(frac( temp_output_97_0 ) , ( ( 1.0 - frac( ( floor( temp_output_97_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_116_0 = ( temp_output_110_0 + appendResult112 ); + float2 temp_cast_3 = (0.5).xx; + float2 temp_output_21_0 = ( temp_output_116_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_116_0 )).rg - temp_cast_3 ) * frac( mulTime126 ) * -_UVMotionMultiplier ) ); + float temp_output_135_0 = ( ceil( mulTime126 ) / _Columns ); + float2 appendResult138 = (float2(frac( temp_output_135_0 ) , ( ( 1.0 - frac( ( floor( temp_output_135_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_141_0 = ( temp_output_110_0 + appendResult138 ); + float2 temp_cast_5 = (0.5).xx; + float2 temp_output_22_0 = ( temp_output_141_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_141_0 )).rg - temp_cast_5 ) * ( 1.0 - frac( mulTime126 ) ) * -1.0 * -_UVMotionMultiplier ) ); + float4 lerpResult4 = lerp( SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, temp_output_21_0 ) , SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, temp_output_22_0 ) , frac( mulTime126 )); + + float2 temp_cast_7 = (0.5).xx; + float3 unpack177 = UnpackNormalScale( SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, temp_output_21_0 ), ( 1.0 - frac( mulTime126 ) ) ); + unpack177.z = lerp( 1, unpack177.z, saturate(( 1.0 - frac( mulTime126 ) )) ); + float2 temp_cast_8 = (0.5).xx; + float3 unpack179 = UnpackNormalScale( SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, temp_output_22_0 ), frac( mulTime126 ) ); + unpack179.z = lerp( 1, unpack179.z, saturate(frac( mulTime126 )) ); + + float2 temp_cast_9 = (0.5).xx; + float2 temp_cast_10 = (0.5).xx; + float4 lerpResult181 = lerp( SAMPLE_TEXTURE2D( _MetallicGlossMap, sampler_MetallicGlossMap, temp_output_21_0 ) , SAMPLE_TEXTURE2D( _MetallicGlossMap, sampler_MetallicGlossMap, temp_output_22_0 ) , frac( mulTime126 )); + float4 break189 = lerpResult181; + + float3 Albedo = ( IN.ase_color * _Color * lerpResult4 ).rgb; + float3 Normal = BlendNormal( unpack177 , unpack179 ); + float3 Emission = 0; +#if 0 + float3 BakedEmission = 0; +#endif + float3 Specular = 0.5; + float Metallic = break189.r; + float Smoothness = break189.b; + float Occlusion = break189.g; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _CLEARCOAT + float CoatMask = 0; + float CoatSmoothness = 0; + #endif + + #if defined(_FLUORESCENCE) + float4 Fluorescence = 0; + float4 Absorbance = 0; + #endif + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = ShadowCoords; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + + #ifdef ASE_FOG + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzww; //TODO: Shuffle things in vertex streams so we get full RGBA color rather than RGBB here + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xyz, IN.dynamicLightmapUV.xy, IN.vertexSH, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, IN.vertexSH , inputData.normalWS); + #endif + + #else + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + #endif + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = Albedo; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + #if defined(_FLUORESCENCE) + surfaceData.fluorescence = Fluorescence; + surfaceData.absorbance = Absorbance; + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData); + #endif + + half4 color = UniversalFragmentPBR( inputData, surfaceData); + + #ifdef LIGHTMAP_ON + float3 MetalSpec = lerp(kDieletricSpec.rgb, surfaceData.albedo , surfaceData.metallic); + color.rgb += BakedSpecular * surfaceData.occlusion * MetalSpec * inputData.bakedGI.rgb; + #endif + + #ifdef _TRANSMISSION_ASE + { + float shadow = _TransmissionShadow; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; + color.rgb += Albedo * mainTransmission; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; + color.rgb += Albedo * transmission; + } + #endif + } + #endif + + #ifdef _TRANSLUCENCY_ASE + { + float shadow = _TransShadow; + float normal = _TransNormal; + float scattering = _TransScattering; + float direct = _TransDirect; + float ambient = _TransAmbient; + float strength = _TransStrength; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + + half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; + half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); + half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * mainTranslucency * strength; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 lightDir = light.direction + inputData.normalWS * normal; + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * translucency * strength; + } + #endif + } + #endif + + #ifdef _REFRACTION_ASE + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, IN.fogFactorAndVertexLight.x); + #endif + #endif + + color = Volumetrics( color, inputData.positionWS); + + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return color; + } + + ENDHLSL + } + + + Pass + { + + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + float3 _LightDirection; + float3 _LightPosition; + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + float3 normalWS = TransformObjectToWorldDir(v.ase_normal); + + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + float2 vShadowOffsets = GetShadowOffsets( normalWS, lightDirectionWS ); + positionWS.xyz -= vShadowOffsets.y * lightDirectionWS.xyz * .01; + float4 clipPos = TransformObjectToHClip( float4( mul( unity_WorldToObject, float4( positionWS.xyz, 1.0 ) ).xyz, 1.0 ) ); + //float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + #if UNITY_REVERSED_Z + clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #else + clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #endif + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = clipPos; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + return 0; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + + Pass + { + + Name "Meta" + Tags { "LightMode"="Meta" } + + Cull Off + + HLSLPROGRAM + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature _ EDITOR_VISUALIZATION + + #define SHADERPASS SHADERPASS_META + + #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/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef EDITOR_VISUALIZATION + float4 VizUV : TEXCOORD2; + float4 LightCoord : TEXCOORD3; + #endif + float4 ase_color : COLOR; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_MainTex); + TEXTURE2D(_MotionVectors); + SAMPLER(sampler_MotionVectors); + SAMPLER(sampler_MainTex); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_color = v.ase_color; + o.ase_texcoord4.xy = v.texcoord0.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.clipPos = MetaVertexPosition( v.vertex, v.texcoord1.xy, v.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); + + #ifdef EDITOR_VISUALIZATION + float2 VizUV = 0; + float4 LightCoord = 0; + UnityEditorVizData(v.vertex.xyz, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, VizUV, LightCoord); + o.VizUV = float4(VizUV, 0, 0); + o.LightCoord = LightCoord; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = o.clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + o.ase_color = v.ase_color; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 texCoord87 = IN.ase_texcoord4.xy * float2( 1,1 ) + float2( 0,0 ); + float2 appendResult109 = (float2((float)_Columns , (float)_Rows)); + float2 temp_output_110_0 = ( texCoord87 / appendResult109 ); + float mulTime126 = _TimeParameters.x * _Framerate; + float temp_output_97_0 = ( floor( mulTime126 ) / _Columns ); + float2 appendResult112 = (float2(frac( temp_output_97_0 ) , ( ( 1.0 - frac( ( floor( temp_output_97_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_116_0 = ( temp_output_110_0 + appendResult112 ); + float2 temp_cast_3 = (0.5).xx; + float2 temp_output_21_0 = ( temp_output_116_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_116_0 )).rg - temp_cast_3 ) * frac( mulTime126 ) * -_UVMotionMultiplier ) ); + float temp_output_135_0 = ( ceil( mulTime126 ) / _Columns ); + float2 appendResult138 = (float2(frac( temp_output_135_0 ) , ( ( 1.0 - frac( ( floor( temp_output_135_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_141_0 = ( temp_output_110_0 + appendResult138 ); + float2 temp_cast_5 = (0.5).xx; + float2 temp_output_22_0 = ( temp_output_141_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_141_0 )).rg - temp_cast_5 ) * ( 1.0 - frac( mulTime126 ) ) * -1.0 * -_UVMotionMultiplier ) ); + float4 lerpResult4 = lerp( SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, temp_output_21_0 ) , SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, temp_output_22_0 ) , frac( mulTime126 )); + + + float3 Albedo = ( IN.ase_color * _Color * lerpResult4 ).rgb; + float3 Emission = 0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = Albedo; + metaInput.Emission = Emission; + #ifdef EDITOR_VISUALIZATION + metaInput.VizUV = IN.VizUV.xy; + metaInput.LightCoord = IN.LightCoord; + #endif + + return MetaFragment(metaInput); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "BakedRaytrace" + Tags{ "LightMode" = "BakedRaytrace" } + HLSLPROGRAM + + /*ase_pragma_before*/ + + #define SHADERPASS SHADERPASS_RAYTRACE + + #include "UnityRaytracingMeshUtils.cginc" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #define _EMISSION + #pragma raytracing test + #pragma shader_feature_local __ _ALBEDOMULTIPLY_ON + #pragma shader_feature_local __ _EMISSION_ON + + /*ase_pragma*/ + + struct RayPayload + { + float4 color; + float3 dir; + }; + + struct AttributeData + { + float2 barycentrics; + }; + + struct Vertex + { + float2 texcoord; + float3 normal; + }; + + Texture2D _BaseMap; + SamplerState sampler_BaseMap; + + CBUFFER_START( UnityPerMaterial ) + /*ase_srp_batcher*/ + Texture2D _EmissionMap; + SamplerState sampler_EmissionMap; + + float4 _EmissionColor; + float4 _BaseMap_ST; + float _BakedMutiplier = 1; + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + //https://coty.tips/raytracing-in-unity/ + [shader("closesthit")] + void MyClosestHit(inout RayPayload payload, + AttributeData attributes : SV_IntersectionAttributes) { + + payload.color = float4(0,0,0,1); //Intializing + payload.dir = float3(1,0,0); + + // #if _EMISSION_ON + uint2 launchIdx = DispatchRaysIndex(); + // ShadingData shade = getShadingData( PrimitiveIndex(), attribs ); + + uint primitiveIndex = PrimitiveIndex(); + uint3 triangleIndicies = UnityRayTracingFetchTriangleIndices(primitiveIndex); + Vertex v0, v1, v2; + + v0.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.x, kVertexAttributeTexCoord0); + v1.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.y, kVertexAttributeTexCoord0); + v2.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.z, kVertexAttributeTexCoord0); + + // v0.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.x, kVertexAttributeNormal); + // v1.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.y, kVertexAttributeNormal); + // v2.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.z, kVertexAttributeNormal); + + float3 barycentrics = float3(1.0 - attributes.barycentrics.x - attributes.barycentrics.y, attributes.barycentrics.x, attributes.barycentrics.y); + + Vertex vInterpolated; + vInterpolated.texcoord = v0.texcoord * barycentrics.x + v1.texcoord * barycentrics.y + v2.texcoord * barycentrics.z; + //TODO: Extract normal direction to ignore the backside of emissive objects + //vInterpolated.normal = v0.normal * barycentrics.x + v1.normal * barycentrics.y + v2.normal * barycentrics.z; + // if ( dot(vInterpolated.normal, float3(1,0,0) < 0) ) payload.color = float4(0,10,0,1) ; + // else payload.color = float4(10,0,0,1) ; + + //TODO: Figure out how to tie Amplify into using Texture2d and SamplerState instead of the bundled sampler2D. Forcing names for now. + //#if _ALBEDOMULTIPLY_ON + float4 albedo = float4(_BaseMap.SampleLevel(sampler_BaseMap, vInterpolated.texcoord.xy * _BaseMap_ST.xy + _BaseMap_ST.zw, 0 ).rgb , 1) ; + // #else + // float4 albedo = float4(1,1,1,1); + // #endif + + payload.color = float4( (_EmissionMap.SampleLevel(sampler_EmissionMap, vInterpolated.texcoord * _BaseMap_ST.xy + _BaseMap_ST.zw,0) ).rgb * _EmissionColor.rgb * albedo.rgb * _BakedMutiplier , 1 ); + // #else + // payload.color = float4(0,0,0,1); + + // #endif + } + ENDHLSL + + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend One Zero, One Zero + ColorMask RGBA + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_2D + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_color : COLOR; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_color : COLOR; + float4 ase_texcoord2 : TEXCOORD2; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_MainTex); + TEXTURE2D(_MotionVectors); + SAMPLER(sampler_MotionVectors); + SAMPLER(sampler_MainTex); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID( v ); + UNITY_TRANSFER_INSTANCE_ID( v, o ); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + o.ase_color = v.ase_color; + o.ase_texcoord2.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord2.zw = 0; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_color : COLOR; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_color = v.ase_color; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 texCoord87 = IN.ase_texcoord2.xy * float2( 1,1 ) + float2( 0,0 ); + float2 appendResult109 = (float2((float)_Columns , (float)_Rows)); + float2 temp_output_110_0 = ( texCoord87 / appendResult109 ); + float mulTime126 = _TimeParameters.x * _Framerate; + float temp_output_97_0 = ( floor( mulTime126 ) / _Columns ); + float2 appendResult112 = (float2(frac( temp_output_97_0 ) , ( ( 1.0 - frac( ( floor( temp_output_97_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_116_0 = ( temp_output_110_0 + appendResult112 ); + float2 temp_cast_3 = (0.5).xx; + float2 temp_output_21_0 = ( temp_output_116_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_116_0 )).rg - temp_cast_3 ) * frac( mulTime126 ) * -_UVMotionMultiplier ) ); + float temp_output_135_0 = ( ceil( mulTime126 ) / _Columns ); + float2 appendResult138 = (float2(frac( temp_output_135_0 ) , ( ( 1.0 - frac( ( floor( temp_output_135_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_141_0 = ( temp_output_110_0 + appendResult138 ); + float2 temp_cast_5 = (0.5).xx; + float2 temp_output_22_0 = ( temp_output_141_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_141_0 )).rg - temp_cast_5 ) * ( 1.0 - frac( mulTime126 ) ) * -1.0 * -_UVMotionMultiplier ) ); + float4 lerpResult4 = lerp( SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, temp_output_21_0 ) , SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, temp_output_22_0 ) , frac( mulTime126 )); + + + float3 Albedo = ( IN.ase_color * _Color * lerpResult4 ).rgb; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + half4 color = half4( Albedo, Alpha ); + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + return color; + } + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormals" } + + ZWrite On + Blend One Zero + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/Color.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_BumpMap); + TEXTURE2D(_MotionVectors); + SAMPLER(sampler_MotionVectors); + SAMPLER(sampler_BumpMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_texcoord4.xy = v.ase_texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord4.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal( v.ase_normal ); + float4 tangentWS = float4(TransformObjectToWorldDir( v.ase_tangent.xyz), v.ase_tangent.w); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 ase_texcoord : TEXCOORD0; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.ase_texcoord = v.ase_texcoord; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + float3 WorldNormal = IN.worldNormal; + float4 WorldTangent = IN.worldTangent; + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 texCoord87 = IN.ase_texcoord4.xy * float2( 1,1 ) + float2( 0,0 ); + float2 appendResult109 = (float2((float)_Columns , (float)_Rows)); + float2 temp_output_110_0 = ( texCoord87 / appendResult109 ); + float mulTime126 = _TimeParameters.x * _Framerate; + float temp_output_97_0 = ( floor( mulTime126 ) / _Columns ); + float2 appendResult112 = (float2(frac( temp_output_97_0 ) , ( ( 1.0 - frac( ( floor( temp_output_97_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_116_0 = ( temp_output_110_0 + appendResult112 ); + float2 temp_cast_3 = (0.5).xx; + float2 temp_output_21_0 = ( temp_output_116_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_116_0 )).rg - temp_cast_3 ) * frac( mulTime126 ) * -_UVMotionMultiplier ) ); + float3 unpack177 = UnpackNormalScale( SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, temp_output_21_0 ), ( 1.0 - frac( mulTime126 ) ) ); + unpack177.z = lerp( 1, unpack177.z, saturate(( 1.0 - frac( mulTime126 ) )) ); + float temp_output_135_0 = ( ceil( mulTime126 ) / _Columns ); + float2 appendResult138 = (float2(frac( temp_output_135_0 ) , ( ( 1.0 - frac( ( floor( temp_output_135_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_141_0 = ( temp_output_110_0 + appendResult138 ); + float2 temp_cast_5 = (0.5).xx; + float2 temp_output_22_0 = ( temp_output_141_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_141_0 )).rg - temp_cast_5 ) * ( 1.0 - frac( mulTime126 ) ) * -1.0 * -_UVMotionMultiplier ) ); + float3 unpack179 = UnpackNormalScale( SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, temp_output_22_0 ), frac( mulTime126 ) ); + unpack179.z = lerp( 1, unpack179.z, saturate(frac( mulTime126 )) ); + + float3 Normal = BlendNormal( unpack177 , unpack179 ); + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + return half4(packedNormalWS, 0.0); + #else + + #if defined(_NORMALMAP) + #if _NORMAL_DROPOFF_TS + float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz); + float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz)); + #elif _NORMAL_DROPOFF_OS + float3 normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + float3 normalWS = Normal; + #endif + #else + float3 normalWS = WorldNormal; + #endif + + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + #endif + } + ENDHLSL + } + + + Pass + { + + Name "GBuffer" + Tags { "LightMode"="UniversalGBuffer" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM +#define _NORMAL_DROPOFF_TS 1#pragma multi_compile_fog#define ASE_FOG 1#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED#define _NORMALMAP 1#define ASE_SRP_VERSION 999999#define ASE_USING_SAMPLING_MACROS 1 +#if FALSE + #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_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 _ _MIXED_LIGHTING_SUBTRACTIVE + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _GBUFFER_NORMALS_OCT + //#pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile _ _RENDER_PASS_ENABLED + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_GBUFFER + + #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/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_color : COLOR; + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + TEXTURE2D(_MainTex); + TEXTURE2D(_MotionVectors); + SAMPLER(sampler_MotionVectors); + SAMPLER(sampler_MainTex); + TEXTURE2D(_BumpMap); + SAMPLER(sampler_BumpMap); + TEXTURE2D(_MetallicGlossMap); + SAMPLER(sampler_MetallicGlossMap); + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_color = v.ase_color; + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + o.ase_color = v.ase_color; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + FragmentOutput frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #else + ShadowCoords = float4(0, 0, 0, 0); + #endif + + + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float2 texCoord87 = IN.ase_texcoord8.xy * float2( 1,1 ) + float2( 0,0 ); + float2 appendResult109 = (float2((float)_Columns , (float)_Rows)); + float2 temp_output_110_0 = ( texCoord87 / appendResult109 ); + float mulTime126 = _TimeParameters.x * _Framerate; + float temp_output_97_0 = ( floor( mulTime126 ) / _Columns ); + float2 appendResult112 = (float2(frac( temp_output_97_0 ) , ( ( 1.0 - frac( ( floor( temp_output_97_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_116_0 = ( temp_output_110_0 + appendResult112 ); + float2 temp_cast_3 = (0.5).xx; + float2 temp_output_21_0 = ( temp_output_116_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_116_0 )).rg - temp_cast_3 ) * frac( mulTime126 ) * -_UVMotionMultiplier ) ); + float temp_output_135_0 = ( ceil( mulTime126 ) / _Columns ); + float2 appendResult138 = (float2(frac( temp_output_135_0 ) , ( ( 1.0 - frac( ( floor( temp_output_135_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float2 temp_output_141_0 = ( temp_output_110_0 + appendResult138 ); + float2 temp_cast_5 = (0.5).xx; + float2 temp_output_22_0 = ( temp_output_141_0 + ( ( (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, temp_output_141_0 )).rg - temp_cast_5 ) * ( 1.0 - frac( mulTime126 ) ) * -1.0 * -_UVMotionMultiplier ) ); + float4 lerpResult4 = lerp( SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, temp_output_21_0 ) , SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, temp_output_22_0 ) , frac( mulTime126 )); + + float2 temp_cast_7 = (0.5).xx; + float3 unpack177 = UnpackNormalScale( SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, temp_output_21_0 ), ( 1.0 - frac( mulTime126 ) ) ); + unpack177.z = lerp( 1, unpack177.z, saturate(( 1.0 - frac( mulTime126 ) )) ); + float2 temp_cast_8 = (0.5).xx; + float3 unpack179 = UnpackNormalScale( SAMPLE_TEXTURE2D( _BumpMap, sampler_BumpMap, temp_output_22_0 ), frac( mulTime126 ) ); + unpack179.z = lerp( 1, unpack179.z, saturate(frac( mulTime126 )) ); + + float2 temp_cast_9 = (0.5).xx; + float2 temp_cast_10 = (0.5).xx; + float4 lerpResult181 = lerp( SAMPLE_TEXTURE2D( _MetallicGlossMap, sampler_MetallicGlossMap, temp_output_21_0 ) , SAMPLE_TEXTURE2D( _MetallicGlossMap, sampler_MetallicGlossMap, temp_output_22_0 ) , frac( mulTime126 )); + float4 break189 = lerpResult181; + + float3 Albedo = ( IN.ase_color * _Color * lerpResult4 ).rgb; + float3 Normal = BlendNormal( unpack177 , unpack179 ); + float3 Emission = 0; + float3 Specular = 0.5; + float Metallic = break189.r; + float Smoothness = break189.b; + float Occlusion = break189.g; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = IN.clipPos; + inputData.shadowCoord = ShadowCoords; + + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + #else + inputData.normalWS = WorldNormal; + #endif + + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + inputData.viewDirectionWS = SafeNormalize( WorldViewDirection ); + + + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(WorldPosition, 1.0), IN.fogFactorAndVertexLight.x); + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.clipPos, + Albedo, + Specular, + inputData.normalWS, + Metallic, + Occlusion, + Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData + (Albedo, Metallic, Specular, Smoothness, Alpha, brdfData); + + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + half4 color; + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + color.a = Alpha; + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _NORMALMAP 1 + #define ASE_SRP_VERSION 999999 + #define ASE_USING_SAMPLING_MACROS 1 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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/SLZBlueNoise.hlsl" + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if defined(_ALPHATEST_ON) && !defined(ASE_TERRAIN) + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphLitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +2190;459;1920;600;-115.3444;962.3633;2.195118;True;True +Node;AmplifyShaderEditor.CommentaryNode;129;-4667.317,-1560.812;Inherit;False;2483.175;1723.904;Comment;36;87;140;139;138;137;136;135;134;133;132;131;101;122;112;123;105;97;107;106;104;108;103;128;130;126;98;116;110;82;81;109;141;144;145;152;153;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;162;467.4616,991.5551;Inherit;False;1309.276;536.674;Baked;8;149;150;148;156;155;154;161;157;Baked;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;32;-2220.243,304.0236;Inherit;False;1565.432;670.7075;Motion Vector interpolation;16;14;19;16;27;15;29;20;24;18;26;23;25;22;21;185;186;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;84;-2057.125,-460.3955;Inherit;False;200;161;Comment;1;83;UV0;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;79;-2050.404,-55.23522;Inherit;False;200;161;Comment;1;78;frame lerp;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;31;-186.6399,-987.8739;Inherit;False;1091.596;477.5999;Main Texture frame blend;4;2;1;4;3;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;85;-2046.481,-258.3556;Inherit;False;200;161;UV1;1;80;UV1;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;180;-192.2284,52.43753;Inherit;False;1091.596;477.5999;Main Texture frame blend;4;184;183;182;181;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;175;-180.5987,-464.6546;Inherit;False;1091.596;477.5999;Main Texture frame blend;13;179;178;177;168;165;166;172;171;169;170;167;188;187;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;20;-1262.94,603.0074;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.FloorOpNode;103;-3904.926,-1337.767;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RegisterLocalVarNode;153;-3870.503,-1108.609;Inherit;False;R;-1;True;1;0;INT;0;False;1;INT;0 +Node;AmplifyShaderEditor.IntNode;82;-4107.079,-1259.714;Inherit;False;Property;_Columns;Columns;10;0;Create;True;0;0;0;False;0;False;8;1;False;0;1;INT;0 +Node;AmplifyShaderEditor.SimpleTimeNode;126;-4481.882,-1436.698;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TexCoordVertexDataNode;10;-2786.698,1948.91;Inherit;False;1;3;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.StaticSwitch;72;-1696.876,2002.386;Inherit;False;Property;_ScaleDepthDither;Scale Depth Dither;8;0;Create;True;0;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;True;True;All;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;46;-1780.333,1850.196;Inherit;False;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0.5;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.BreakToComponentsNode;189;1686.322,-342.1209;Inherit;False;COLOR;1;0;COLOR;0,0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 +Node;AmplifyShaderEditor.RangedFloatNode;48;-1967.657,1960.338;Inherit;False;Constant;_Float1;Float 1;2;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;69;-1824.897,2102.173;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RelayNode;80;-1996.481,-208.3555;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.IntNode;81;-4098.651,-1157.766;Inherit;False;Property;_Rows;Rows;9;0;Create;True;0;0;0;False;0;False;4;1;False;0;1;INT;0 +Node;AmplifyShaderEditor.FractNode;191;-2244.639,-553.7288;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.RelayNode;128;-4229.118,-1366.943;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;116;-2560.913,-758.7842;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;23;-1099.354,744.2953;Inherit;False;4;4;0;FLOAT2;0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.TemplateFragmentDataNode;51;-1403.448,2073.357;Inherit;False;0;0;clipPos;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.FunctionNode;68;-2079.864,1858.284;Inherit;False;Global Blue Noise Sample;-1;;60;bac712bbbce65c14c9d4cbc808f3d0e0;0;2;8;FLOAT2;0,0;False;10;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.IntNode;65;-2266.384,2016.9;Inherit;False;Global;NoiseArraySize;NoiseArraySize;2;0;Create;True;0;0;0;False;0;False;64;64;False;0;1;INT;0 +Node;AmplifyShaderEditor.RegisterLocalVarNode;152;-3868.503,-1183.609;Inherit;False;C;-1;True;1;0;INT;0;False;1;INT;0 +Node;AmplifyShaderEditor.OneMinusNode;26;-1167.432,543.6097;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FunctionNode;47;-1328.923,1845.467;Inherit;False;Depth Offseting;-1;;61;f08568184ae023c44bfc8baedfb827a9;0;2;1;FLOAT;0;False;10;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;104;-3448.457,-1166.648;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;19;-1412.165,518.751;Float;False;Constant;_5;.5;3;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;190;-2244.639,-313.7288;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.FloorOpNode;101;-3563.798,-1270.216;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;132;-3747.082,-538.6045;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FloorOpNode;140;-3862.423,-642.1724;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.OneMinusNode;131;-3514.413,-343.9341;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;133;-3692.356,-341.6533;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RelayNode;83;-2007.125,-410.3956;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;18;-1268.016,403.0251;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;52;-1573.019,1856.026;Inherit;False;2;2;0;FLOAT4;1,0,0,0;False;1;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.RangedFloatNode;24;-1272.342,776.7422;Float;False;Constant;_Float0;Float 0;3;0;Create;True;0;0;0;False;0;False;-1;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;21;-952.8717,354.0236;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.FractNode;105;-3305.3,-1122.35;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;123;-3504.258,-888.2106;Inherit;False;2;0;INT;1;False;1;INT;0;False;1;INT;0 +Node;AmplifyShaderEditor.OneMinusNode;108;-3215.788,-971.978;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;135;-4021.411,-677.8364;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WireNode;107;-3582.068,-1083.446;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.CeilOpNode;130;-4169.895,-727.0346;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RelayNode;78;-2000.405,-5.235178;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WireNode;134;-3880.693,-455.4023;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;106;-3393.731,-969.6971;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;50;-2005.851,2048.018;Inherit;False;Property;_Depth;Depth;7;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;64;-2173.058,2100.61;Inherit;False;2;2;0;INT;64;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;27;-1776.324,845.6664;Float;False;Property;_UVMotionMultiplier;UV Motion Multiplier;5;0;Create;True;0;0;0;False;0;False;0;0.5;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.DynamicAppendNode;109;-3508.764,-781.7744;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;25;-1120.2,419.6911;Inherit;False;3;3;0;FLOAT2;0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;141;-2528.614,-310.7851;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;122;-3032.439,-891.9513;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;97;-3755.8,-1277.217;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;157;696.2112,1182.234;Inherit;False;2;0;FLOAT4;1,1,0,0;False;1;FLOAT4;1,1,0,0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.OneMinusNode;188;-36.6892,-179.5613;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;22;-889.8067,587.6949;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;139;-3331.064,-263.9076;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;87;-3357.61,-711.0641;Inherit;True;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.GetLocalVarNode;154;517.4617,1293.391;Inherit;False;152;C;1;0;OBJECT;;False;1;INT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;110;-3015.726,-758.4483;Inherit;True;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.DynamicAppendNode;112;-2856.368,-941.3546;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.DynamicAppendNode;138;-3154.993,-313.3108;Inherit;True;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;156;826.1672,1164.612;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.WireNode;144;-4298.254,-173.5045;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TexturePropertyNode;3;-136.6398,-887.4448;Float;True;Property;_MainTex;Base Map;0;1;[NoScaleOffset];Create;False;0;0;0;False;0;False;None;12d2a54817ebe334db38e85a687d9439;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.SamplerNode;148;1109.224,1165.433;Inherit;True;Property;_TextureSample5;Texture Sample 1;3;0;Create;True;0;0;0;False;0;False;-1;None;None;True;1;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.DynamicAppendNode;161;713.8324,1345.229;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.FractNode;136;-3601.556,-454.0374;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TexturePropertyNode;14;-2170.243,513.1923;Float;True;Property;_MotionVectors;Motion Vectors;4;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;None;eb58c36f965ff024cb94d9bba46e33e7;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.SimpleDivideOpNode;137;-3802.883,-260.167;Inherit;False;2;0;INT;1;False;1;INT;0;False;1;INT;0 +Node;AmplifyShaderEditor.SamplerNode;16;-1762.902,597.855;Inherit;True;Property;_TextureSample3;Texture Sample 3;3;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SwizzleNode;186;-1409.522,412.7811;Inherit;False;FLOAT2;0;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;11;1306.679,-696.6684;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.LerpOp;181;715.3683,266.2374;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;149;1614.737,1041.555;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;145;-4473.97,-774.8016;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.BlendNormalsNode;187;677.9264,-266.3248;Inherit;False;0;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0 +Node;AmplifyShaderEditor.VertexColorNode;12;963.4551,-904.7579;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.LerpOp;4;720.9565,-774.074;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SamplerNode;1;312.7569,-937.8739;Inherit;True;Property;_TextureSample0;Texture Sample 0;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SamplerNode;2;317.4572,-747.2738;Inherit;True;Property;_TextureSample1;Texture Sample 1;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;1;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SamplerNode;177;318.7981,-414.6546;Inherit;True;Property;_TextureSample4;Texture Sample 0;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.ColorNode;34;925.9869,-1091.493;Float;False;Property;_Color;Color;6;1;[HDR];Create;True;0;0;0;False;0;False;1,1,1,1;1,0.2311321,0.2311321,1;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SamplerNode;184;311.8688,293.0377;Inherit;True;Property;_TextureSample8;Texture Sample 1;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;1;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.GetLocalVarNode;155;531.2778,1364.058;Inherit;False;153;R;1;0;OBJECT;;False;1;INT;0 +Node;AmplifyShaderEditor.SamplerNode;15;-1692.873,405.1295;Inherit;True;Property;_TextureSample2;Texture Sample 2;3;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SamplerNode;182;307.1685,102.4376;Inherit;True;Property;_TextureSample7;Texture Sample 0;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SwizzleNode;185;-1431.16,637.3817;Inherit;False;FLOAT2;0;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.RangedFloatNode;98;-4649.447,-1435.346;Inherit;False;Property;_Framerate;Framerate;11;0;Create;True;0;0;0;False;0;False;30;0.2;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.TexturePropertyNode;183;-142.2284,152.8665;Float;True;Property;_MetallicGlossMap;MAS;2;1;[NoScaleOffset];Create;False;0;0;0;False;0;False;None;eeb676f899ce47e44be8eb023d19544e;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.TexturePropertyNode;178;-130.5987,-364.2256;Float;True;Property;_BumpMap;Bump Map;1;2;[NoScaleOffset];[Normal];Create;False;0;0;0;False;0;False;None;27f95b5ccf25af6488ae167374bd99dd;True;bump;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.SamplerNode;179;323.4984,-224.0545;Inherit;True;Property;_TextureSample6;Texture Sample 1;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;1;False;white;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;150;1146.704,1366.744;Inherit;False;Property;_BakedEmissionMultiplier;Baked Emission Multiplier;12;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.NegateNode;29;-1482.896,814.2148;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;164;1964.221,-508.3861;Half;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;SLZ/Motion Vector Lit;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;23;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalForward;False;False;0;Hidden/InternalErrorShader;0;0;Standard;48;Workflow;1;0;Surface;0;0; Refraction Model;0;0; Blend;0;0;Two Sided;1;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Transmission;0;0; Transmission Shadow;0.5,False,-1;0;Translucency;0;0; Translucency Strength;1,False,-1;0; Normal Distortion;0.5,False,-1;0; Scattering;2,False,-1;0; Direct;0.9,False,-1;0; Ambient;0.1,False,-1;0; Shadow;0.5,False,-1;0;Cast Shadows;1;0; Use Shadow Threshold;0;0;Receive Shadows;1;0;GPU Instancing;0;637849824471988096;LOD CrossFade;0;637829811356983843;Built-in Fog;1;0;Lightmaps;1;0;Volumetrics;1;0;Decals;0;637849824449892631;Screen Space Occlusion;1;637965419590000744;Reflection Probe Blend/Projection;1;0;Light Layers;0;637849824444346761;_FinalColorxAlpha;0;0;Meta Pass;1;0;GBuffer Pass;0;0;Override Baked GI;0;0;Extra Pre Pass;0;0;DOTS Instancing;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Write Depth;0;0; Early Z;0;0;Vertex Position,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;0;0;Fluorescence;0;0;0;10;False;True;True;True;True;True;True;True;True;True;False;;True;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;168;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;163;1964.221,-508.3861;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;172;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;169;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormals;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;167;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;171;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;170;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;166;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;165;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +WireConnection;20;0;185;0 +WireConnection;20;1;19;0 +WireConnection;103;0;128;0 +WireConnection;153;0;81;0 +WireConnection;126;0;98;0 +WireConnection;72;1;50;0 +WireConnection;72;0;69;0 +WireConnection;46;0;68;0 +WireConnection;46;1;48;0 +WireConnection;189;0;181;0 +WireConnection;69;0;50;0 +WireConnection;69;1;10;3 +WireConnection;80;0;141;0 +WireConnection;191;0;116;0 +WireConnection;128;0;126;0 +WireConnection;116;0;110;0 +WireConnection;116;1;112;0 +WireConnection;23;0;20;0 +WireConnection;23;1;26;0 +WireConnection;23;2;24;0 +WireConnection;23;3;29;0 +WireConnection;68;10;64;0 +WireConnection;152;0;82;0 +WireConnection;26;0;78;0 +WireConnection;47;1;52;0 +WireConnection;47;10;51;4 +WireConnection;104;0;101;0 +WireConnection;104;1;81;0 +WireConnection;190;0;141;0 +WireConnection;101;0;97;0 +WireConnection;132;0;140;0 +WireConnection;132;1;81;0 +WireConnection;140;0;135;0 +WireConnection;131;0;133;0 +WireConnection;133;0;132;0 +WireConnection;83;0;116;0 +WireConnection;18;0;186;0 +WireConnection;18;1;19;0 +WireConnection;52;0;46;0 +WireConnection;52;1;72;0 +WireConnection;21;0;83;0 +WireConnection;21;1;25;0 +WireConnection;105;0;107;0 +WireConnection;123;1;81;0 +WireConnection;108;0;106;0 +WireConnection;135;0;130;0 +WireConnection;135;1;82;0 +WireConnection;107;0;97;0 +WireConnection;130;0;128;0 +WireConnection;78;0;144;0 +WireConnection;134;0;135;0 +WireConnection;106;0;104;0 +WireConnection;64;0;65;0 +WireConnection;64;1;10;2 +WireConnection;109;0;82;0 +WireConnection;109;1;81;0 +WireConnection;25;0;18;0 +WireConnection;25;1;78;0 +WireConnection;25;2;29;0 +WireConnection;141;0;110;0 +WireConnection;141;1;138;0 +WireConnection;122;0;108;0 +WireConnection;122;1;123;0 +WireConnection;97;0;103;0 +WireConnection;97;1;82;0 +WireConnection;157;1;161;0 +WireConnection;188;0;78;0 +WireConnection;22;0;80;0 +WireConnection;22;1;23;0 +WireConnection;139;0;131;0 +WireConnection;139;1;137;0 +WireConnection;110;0;87;0 +WireConnection;110;1;109;0 +WireConnection;112;0;105;0 +WireConnection;112;1;122;0 +WireConnection;138;0;136;0 +WireConnection;138;1;139;0 +WireConnection;156;0;157;0 +WireConnection;144;0;145;0 +WireConnection;148;1;156;0 +WireConnection;161;0;154;0 +WireConnection;161;1;155;0 +WireConnection;136;0;134;0 +WireConnection;137;1;81;0 +WireConnection;16;0;14;0 +WireConnection;16;1;80;0 +WireConnection;186;0;15;0 +WireConnection;11;0;12;0 +WireConnection;11;1;34;0 +WireConnection;11;2;4;0 +WireConnection;181;0;182;0 +WireConnection;181;1;184;0 +WireConnection;181;2;78;0 +WireConnection;149;2;150;0 +WireConnection;145;0;128;0 +WireConnection;187;0;177;0 +WireConnection;187;1;179;0 +WireConnection;4;0;1;0 +WireConnection;4;1;2;0 +WireConnection;4;2;78;0 +WireConnection;1;0;3;0 +WireConnection;1;1;21;0 +WireConnection;2;0;3;0 +WireConnection;2;1;22;0 +WireConnection;177;0;178;0 +WireConnection;177;1;21;0 +WireConnection;177;5;188;0 +WireConnection;184;0;183;0 +WireConnection;184;1;22;0 +WireConnection;15;0;14;0 +WireConnection;15;1;83;0 +WireConnection;182;0;183;0 +WireConnection;182;1;21;0 +WireConnection;185;0;16;0 +WireConnection;179;0;178;0 +WireConnection;179;1;22;0 +WireConnection;179;5;78;0 +WireConnection;29;0;27;0 +WireConnection;164;0;11;0 +WireConnection;164;1;187;0 +WireConnection;164;3;189;0 +WireConnection;164;4;189;2 +WireConnection;164;5;189;1 +ASEEND*/ +//CHKSM=8C0A95AC2B891EDC9DCA6553343D703D993B4CFA \ No newline at end of file diff --git a/Assets/SLZShaders/VR_MotionVectorLit.shader.meta b/Assets/SLZShaders/VR_MotionVectorLit.shader.meta new file mode 100644 index 0000000..629066e --- /dev/null +++ b/Assets/SLZShaders/VR_MotionVectorLit.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 4a1250fb7f0da2e4e96bd2e34ce4a8ea +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/VR_MotionVectorOpaque.shader b/Assets/SLZShaders/VR_MotionVectorOpaque.shader new file mode 100644 index 0000000..e097b1d --- /dev/null +++ b/Assets/SLZShaders/VR_MotionVectorOpaque.shader @@ -0,0 +1,3334 @@ +// Made with Amplify Shader Editor +// Available at the Unity Asset Store - http://u3d.as/y3X +Shader "SLZ/Motion Vector Opaque" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) + [ASEBegin][NoScaleOffset]_MainTex("Main Texture", 2D) = "white" {} + [NoScaleOffset]_MotionVectors("Motion Vectors", 2D) = "white" {} + _UVMotionMultiplier("UV Motion Multiplier", Float) = 0 + [HDR]_Color("Color", Color) = (1,1,1,1) + _Rows("Rows", Int) = 4 + _Columns("Columns", Int) = 8 + [ASEEnd]_Framerate("Framerate", Float) = 30 + + [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) = "" {} + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + } + + SubShader + { + LOD 0 + +HLSLINCLUDE +#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PlatformCompiler.hlsl" +ENDHLSL + + + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" } + Cull Back + ZWrite On + ZTest LEqual + Offset 0 , 0 + AlphaToMask Off + + HLSLINCLUDE + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForward" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _EMISSION + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_FORWARD + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.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.core/ShaderLibrary/TextureStack.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.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.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_color : COLOR; + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _MainTex; + sampler2D _MotionVectors; + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_color = v.ase_color; + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + o.ase_color = v.ase_color; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float3 temp_cast_0 = (0.0).xxx; + + float2 texCoord87 = IN.ase_texcoord8.xy * float2( 1,1 ) + float2( 0,0 ); + float2 appendResult109 = (float2((float)_Columns , (float)_Rows)); + float2 temp_output_110_0 = ( texCoord87 / appendResult109 ); + float mulTime126 = _TimeParameters.x * _Framerate; + float temp_output_97_0 = ( floor( mulTime126 ) / _Columns ); + float2 appendResult112 = (float2(frac( temp_output_97_0 ) , ( ( 1.0 - frac( ( floor( temp_output_97_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float4 temp_cast_5 = (0.5).xxxx; + float temp_output_135_0 = ( ceil( mulTime126 ) / _Columns ); + float2 appendResult138 = (float2(frac( temp_output_135_0 ) , ( ( 1.0 - frac( ( floor( temp_output_135_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float4 temp_cast_9 = (0.5).xxxx; + float4 lerpResult4 = lerp( tex2D( _MainTex, ( float4( ( temp_output_110_0 + appendResult112 ), 0.0 , 0.0 ) + ( ( tex2D( _MotionVectors, ( temp_output_110_0 + appendResult112 ) ) - temp_cast_5 ) * frac( mulTime126 ) * -_UVMotionMultiplier ) ).rg ) , tex2D( _MainTex, ( float4( ( temp_output_110_0 + appendResult138 ), 0.0 , 0.0 ) + ( ( tex2D( _MotionVectors, ( temp_output_110_0 + appendResult138 ) ) - temp_cast_9 ) * ( 1.0 - frac( mulTime126 ) ) * -1.0 * -_UVMotionMultiplier ) ).rg ) , frac( mulTime126 )); + float4 temp_output_11_0 = ( IN.ase_color * _Color * lerpResult4 ); + + float3 Albedo = temp_cast_0; + float3 Normal = float3(0, 0, 1); + float3 Emission = temp_output_11_0.rgb; +#if 0 + float3 BakedEmission = 0; +#endif + float3 Specular = 0.5; + float Metallic = 0.0; + float Smoothness = 0.0; + float Occlusion = 0.0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _CLEARCOAT + float CoatMask = 0; + float CoatSmoothness = 0; + #endif + + #if defined(_FLUORESCENCE) + float4 Fluorescence = 0; + float4 Absorbance = 0; + #endif + + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = ShadowCoords; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + + #ifdef ASE_FOG + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzww; //TODO: Shuffle things in vertex streams so we get full RGBA color rather than RGBB here + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xyz, IN.dynamicLightmapUV.xy, IN.vertexSH, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, IN.vertexSH , inputData.normalWS); + #endif + + #else + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI_DIR(IN.lightmapUVOrVertexSH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + #endif + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = Albedo; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + #if defined(_FLUORESCENCE) + surfaceData.fluorescence = Fluorescence; + surfaceData.absorbance = Absorbance; + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData); + #endif + + half4 color = UniversalFragmentPBR( inputData, surfaceData); + + #ifdef LIGHTMAP_ON + float3 MetalSpec = lerp(kDieletricSpec.rgb, surfaceData.albedo , surfaceData.metallic); + color.rgb += BakedSpecular * surfaceData.occlusion * MetalSpec * inputData.bakedGI.rgb; + #endif + + #ifdef _TRANSMISSION_ASE + { + float shadow = _TransmissionShadow; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; + color.rgb += Albedo * mainTransmission; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; + color.rgb += Albedo * transmission; + } + #endif + } + #endif + + #ifdef _TRANSLUCENCY_ASE + { + float shadow = _TransShadow; + float normal = _TransNormal; + float scattering = _TransScattering; + float direct = _TransDirect; + float ambient = _TransAmbient; + float strength = _TransStrength; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + + half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; + half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); + half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * mainTranslucency * strength; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 lightDir = light.direction + inputData.normalWS * normal; + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * translucency * strength; + } + #endif + } + #endif + + #ifdef _REFRACTION_ASE + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, IN.fogFactorAndVertexLight.x); + #endif + #endif + + color = Volumetrics( color, inputData.positionWS); + + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return color; + } + + ENDHLSL + } + + + Pass + { + + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _EMISSION + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #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/SLZBlueNoise.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + float3 _LightDirection; + float3 _LightPosition; + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + + float3 normalWS = TransformObjectToWorldDir(v.ase_normal); + + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + float2 vShadowOffsets = GetShadowOffsets( normalWS, lightDirectionWS ); + positionWS.xyz += vShadowOffsets.y * lightDirectionWS.xyz / 1000; + float4 clipPos = TransformObjectToHClip( float4( mul( unity_WorldToObject, float4( positionWS.xyz, 1.0 ) ).xyz, 1.0 ) ); + //float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + #if UNITY_REVERSED_Z + clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #else + clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #endif + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = clipPos; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _ALPHATEST_ON + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + return 0; + } + + ENDHLSL + } + + + Pass + { + + Name "DepthOnly" + Tags { "LightMode"="DepthOnly" } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _EMISSION + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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/SLZBlueNoise.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + + Pass + { + + Name "Meta" + Tags { "LightMode"="Meta" } + + Cull Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _EMISSION + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature _ EDITOR_VISUALIZATION + + #define SHADERPASS SHADERPASS_META + + #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/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef EDITOR_VISUALIZATION + float4 VizUV : TEXCOORD2; + float4 LightCoord : TEXCOORD3; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.clipPos = MetaVertexPosition( v.vertex, v.texcoord1.xy, v.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); + + #ifdef EDITOR_VISUALIZATION + float2 VizUV = 0; + float4 LightCoord = 0; + UnityEditorVizData(v.vertex.xyz, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, VizUV, LightCoord); + o.VizUV = float4(VizUV, 0, 0); + o.LightCoord = LightCoord; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = o.clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float3 temp_cast_0 = (0.0).xxx; + + + float3 Albedo = temp_cast_0; + float3 Emission = 0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = Albedo; + metaInput.Emission = Emission; + #ifdef EDITOR_VISUALIZATION + metaInput.VizUV = IN.VizUV.xy; + metaInput.LightCoord = IN.LightCoord; + #endif + + return MetaFragment(metaInput); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + + Name "BakedRaytrace" + Tags{ "LightMode" = "BakedRaytrace" } + HLSLPROGRAM + + /*ase_pragma_before*/ + + #define SHADERPASS SHADERPASS_RAYTRACE + + #include "UnityRaytracingMeshUtils.cginc" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #define _EMISSION + #pragma raytracing test + #pragma shader_feature_local __ _ALBEDOMULTIPLY_ON + #pragma shader_feature_local __ _EMISSION_ON + + /*ase_pragma*/ + + struct RayPayload + { + float4 color; + float3 dir; + }; + + struct AttributeData + { + float2 barycentrics; + }; + + struct Vertex + { + float2 texcoord; + float3 normal; + }; + + Texture2D _BaseMap; + SamplerState sampler_BaseMap; + + CBUFFER_START( UnityPerMaterial ) + /*ase_srp_batcher*/ + Texture2D _EmissionMap; + SamplerState sampler_EmissionMap; + + float4 _EmissionColor; + float4 _BaseMap_ST; + float _BakedMutiplier = 1; + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + //https://coty.tips/raytracing-in-unity/ + [shader("closesthit")] + void MyClosestHit(inout RayPayload payload, + AttributeData attributes : SV_IntersectionAttributes) { + + payload.color = float4(0,0,0,1); //Intializing + payload.dir = float3(1,0,0); + + // #if _EMISSION_ON + uint2 launchIdx = DispatchRaysIndex(); + // ShadingData shade = getShadingData( PrimitiveIndex(), attribs ); + + uint primitiveIndex = PrimitiveIndex(); + uint3 triangleIndicies = UnityRayTracingFetchTriangleIndices(primitiveIndex); + Vertex v0, v1, v2; + + v0.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.x, kVertexAttributeTexCoord0); + v1.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.y, kVertexAttributeTexCoord0); + v2.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.z, kVertexAttributeTexCoord0); + + // v0.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.x, kVertexAttributeNormal); + // v1.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.y, kVertexAttributeNormal); + // v2.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.z, kVertexAttributeNormal); + + float3 barycentrics = float3(1.0 - attributes.barycentrics.x - attributes.barycentrics.y, attributes.barycentrics.x, attributes.barycentrics.y); + + Vertex vInterpolated; + vInterpolated.texcoord = v0.texcoord * barycentrics.x + v1.texcoord * barycentrics.y + v2.texcoord * barycentrics.z; + //TODO: Extract normal direction to ignore the backside of emissive objects + //vInterpolated.normal = v0.normal * barycentrics.x + v1.normal * barycentrics.y + v2.normal * barycentrics.z; + // if ( dot(vInterpolated.normal, float3(1,0,0) < 0) ) payload.color = float4(0,10,0,1) ; + // else payload.color = float4(10,0,0,1) ; + + //TODO: Figure out how to tie Amplify into using Texture2d and SamplerState instead of the bundled sampler2D. Forcing names for now. + //#if _ALBEDOMULTIPLY_ON + float4 albedo = float4(_BaseMap.SampleLevel(sampler_BaseMap, vInterpolated.texcoord.xy * _BaseMap_ST.xy + _BaseMap_ST.zw, 0 ).rgb , 1) ; + // #else + // float4 albedo = float4(1,1,1,1); + // #endif + + payload.color = float4( (_EmissionMap.SampleLevel(sampler_EmissionMap, vInterpolated.texcoord * _BaseMap_ST.xy + _BaseMap_ST.zw,0) ).rgb * _EmissionColor.rgb * albedo.rgb * _BakedMutiplier , 1 ); + // #else + // payload.color = float4(0,0,0,1); + + // #endif + } + ENDHLSL + + } + + + Pass + { + + Name "Universal2D" + Tags { "LightMode"="Universal2D" } + + Blend One Zero, One Zero + ColorMask RGBA + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _EMISSION + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_2D + + #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/SLZBlueNoise.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID( v ); + UNITY_TRANSFER_INSTANCE_ID( v, o ); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float3 temp_cast_0 = (0.0).xxx; + + + float3 Albedo = temp_cast_0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + + half4 color = half4( Albedo, Alpha ); + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + return color; + } + ENDHLSL + } + + + Pass + { + + Name "DepthNormals" + Tags { "LightMode"="DepthNormals" } + + ZWrite On + Blend One Zero + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _EMISSION + #define ASE_SRP_VERSION 999999 + + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #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/Color.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = v.ase_normal; + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 normalWS = TransformObjectToWorldNormal( v.ase_normal ); + float4 tangentWS = float4(TransformObjectToWorldDir( v.ase_tangent.xyz), v.ase_tangent.w); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = positionCS; + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + float3 WorldNormal = IN.worldNormal; + float4 WorldTangent = IN.worldTangent; + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + + float3 Normal = float3(0, 0, 1); + float Alpha = 1; + float AlphaClipThreshold = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + return half4(packedNormalWS, 0.0); + #else + + #if defined(_NORMALMAP) + #if _NORMAL_DROPOFF_TS + float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz); + float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz)); + #elif _NORMAL_DROPOFF_OS + float3 normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + float3 normalWS = Normal; + #endif + #else + float3 normalWS = WorldNormal; + #endif + + return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0); + #endif + } + ENDHLSL + } + + + Pass + { + + Name "GBuffer" + Tags { "LightMode"="UniversalGBuffer" } + + Blend One Zero, One Zero + ColorMask RGBA + + + HLSLPROGRAM +#define _NORMAL_DROPOFF_TS 1#pragma multi_compile_instancing#pragma multi_compile_fog#define ASE_FOG 1#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED#define _EMISSION#define ASE_SRP_VERSION 999999 +#if FALSE + #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_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 _ _MIXED_LIGHTING_SUBTRACTIVE + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _GBUFFER_NORMALS_OCT + //#pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile _ _RENDER_PASS_ENABLED + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_GBUFFER + + #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/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + float4 lightmapUVOrVertexSH : TEXCOORD0; + half4 fogFactorAndVertexLight : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + float4 ase_color : COLOR; + float4 ase_texcoord8 : TEXCOORD8; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _MainTex; + sampler2D _MotionVectors; + + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.ase_color = v.ase_color; + o.ase_texcoord8.xy = v.texcoord.xy; + + //setting value to unused interpolator channels and avoid initialization warnings + o.ase_texcoord8.zw = 0; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float3 positionVS = TransformWorldToView( positionWS ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); + + o.tSpace0 = float4( normalInput.normalWS, positionWS.x); + o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); + o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); + + OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + o.lightmapUVOrVertexSH.zw = v.texcoord; + o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + float4 ase_tangent : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + o.ase_tangent = v.ase_tangent; + o.texcoord = v.texcoord; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + o.ase_color = v.ase_color; + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; + o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + o.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + FragmentOutput frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + float3 WorldNormal = normalize( IN.tSpace0.xyz ); + float3 WorldTangent = IN.tSpace1.xyz; + float3 WorldBiTangent = IN.tSpace2.xyz; + #endif + float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #else + ShadowCoords = float4(0, 0, 0, 0); + #endif + + + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + float3 temp_cast_0 = (0.0).xxx; + + float2 texCoord87 = IN.ase_texcoord8.xy * float2( 1,1 ) + float2( 0,0 ); + float2 appendResult109 = (float2((float)_Columns , (float)_Rows)); + float2 temp_output_110_0 = ( texCoord87 / appendResult109 ); + float mulTime126 = _TimeParameters.x * _Framerate; + float temp_output_97_0 = ( floor( mulTime126 ) / _Columns ); + float2 appendResult112 = (float2(frac( temp_output_97_0 ) , ( ( 1.0 - frac( ( floor( temp_output_97_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float4 temp_cast_5 = (0.5).xxxx; + float temp_output_135_0 = ( ceil( mulTime126 ) / _Columns ); + float2 appendResult138 = (float2(frac( temp_output_135_0 ) , ( ( 1.0 - frac( ( floor( temp_output_135_0 ) / _Rows ) ) ) - (float)( 1 / _Rows ) ))); + float4 temp_cast_9 = (0.5).xxxx; + float4 lerpResult4 = lerp( tex2D( _MainTex, ( float4( ( temp_output_110_0 + appendResult112 ), 0.0 , 0.0 ) + ( ( tex2D( _MotionVectors, ( temp_output_110_0 + appendResult112 ) ) - temp_cast_5 ) * frac( mulTime126 ) * -_UVMotionMultiplier ) ).rg ) , tex2D( _MainTex, ( float4( ( temp_output_110_0 + appendResult138 ), 0.0 , 0.0 ) + ( ( tex2D( _MotionVectors, ( temp_output_110_0 + appendResult138 ) ) - temp_cast_9 ) * ( 1.0 - frac( mulTime126 ) ) * -1.0 * -_UVMotionMultiplier ) ).rg ) , frac( mulTime126 )); + float4 temp_output_11_0 = ( IN.ase_color * _Color * lerpResult4 ); + + float3 Albedo = temp_cast_0; + float3 Normal = float3(0, 0, 1); + float3 Emission = temp_output_11_0.rgb; + float3 Specular = 0.5; + float Metallic = 0.0; + float Smoothness = 0.0; + float Occlusion = 0.0; + float Alpha = 1; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = 0; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = IN.clipPos; + inputData.shadowCoord = ShadowCoords; + + + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + #else + inputData.normalWS = WorldNormal; + #endif + + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + inputData.viewDirectionWS = SafeNormalize( WorldViewDirection ); + + + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(WorldPosition, 1.0), IN.fogFactorAndVertexLight.x); + #endif + + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.lightmapUVOrVertexSH.xyz; + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.clipPos, + Albedo, + Specular, + inputData.normalWS, + Metallic, + Occlusion, + Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData + (Albedo, Metallic, Specular, Smoothness, Alpha, brdfData); + + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + half4 color; + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + color.a = Alpha; + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); + #else + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb); + } +#endif + ENDHLSL + } + + + + Pass + { + + Name "SceneSelectionPass" + Tags { "LightMode"="SceneSelectionPass" } + + Cull Off + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _EMISSION + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #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/SLZBlueNoise.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + + Pass + { + + Name "ScenePickingPass" + Tags { "LightMode"="Picking" } + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define _EMISSION + #define ASE_SRP_VERSION 999999 + + + #pragma only_renderers d3d11 glcore gles gles3 + #pragma vertex vert + #pragma fragment frag + + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + + #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/SLZBlueNoise.hlsl" + #pragma multi_compile _ _VOLUMETRICS_ENABLED + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + int _Columns; + int _Rows; + float _Framerate; + float _UVMotionMultiplier; + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + + + + + float4 _SelectionID; + + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + VertexOutput VertexFunction(VertexInput v ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = defaultVertexValue; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.ase_normal = v.ase_normal; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + o.clipPos = TransformWorldToHClip(positionWS); + return o; + } + + #if defined(TESSELLATION_ON) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float3 ase_normal : NORMAL; + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( VertexInput v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.ase_normal = v.ase_normal; + + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; + float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + VertexInput o = (VertexInput) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); + float phongStrength = _TessPhongStrength; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + #endif + + half4 frag(VertexOutput IN ) : SV_TARGET + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.Alpha = 1; + surfaceDescription.AlphaClipThreshold = 0.5; + + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + } + + CustomEditor "UnityEditor.ShaderGraphLitGUI" + Fallback "Hidden/InternalErrorShader" + +} +/*ASEBEGIN +Version=18935 +2103;205;1980;1007;74.75391;517.0854;1;True;True +Node;AmplifyShaderEditor.CommentaryNode;129;-4667.317,-1560.812;Inherit;False;2483.175;1723.904;Comment;36;87;140;139;138;137;136;135;134;133;132;131;101;122;112;123;105;97;107;106;104;108;103;128;130;126;98;116;110;82;81;109;141;144;145;152;153;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;162;-477.0573,503.287;Inherit;False;1309.276;536.674;Baked;8;149;150;148;156;155;154;161;157;Baked;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;32;-2380.879,431.1962;Inherit;False;1565.432;670.7075;Motion Vector interpolation;14;14;19;16;27;15;29;20;24;18;26;23;25;22;21;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;84;-2057.125,-460.3955;Inherit;False;200;161;Comment;1;83;UV0;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;79;-2050.404,-55.23522;Inherit;False;200;161;Comment;1;78;frame lerp;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;31;-1176.52,-192.5386;Inherit;False;1091.596;477.5999;Main Texture frame blend;4;2;1;4;3;;1,1,1,1;0;0 +Node;AmplifyShaderEditor.CommentaryNode;85;-2046.481,-258.3556;Inherit;False;200;161;UV1;1;80;UV1;1,1,1,1;0;0 +Node;AmplifyShaderEditor.FractNode;106;-3393.731,-969.6971;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WireNode;134;-3880.693,-455.4023;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;98;-4631.447,-1437.346;Inherit;False;Property;_Framerate;Framerate;8;0;Create;True;0;0;0;False;0;False;30;0.1;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.FloorOpNode;103;-3904.926,-1337.767;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.CeilOpNode;130;-4169.895,-727.0346;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WireNode;107;-3582.068,-1083.446;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;135;-4021.411,-677.8364;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.OneMinusNode;108;-3215.788,-971.978;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;105;-3305.3,-1122.35;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;104;-3448.457,-1166.648;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;21;-1113.511,481.1962;Inherit;True;2;2;0;FLOAT2;0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.RangedFloatNode;19;-1572.804,645.9233;Float;False;Constant;_5;.5;3;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;18;-1428.655,530.1978;Inherit;False;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.FloorOpNode;101;-3563.798,-1270.216;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RelayNode;83;-2007.125,-410.3956;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.FractNode;133;-3692.356,-341.6533;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.OneMinusNode;131;-3514.413,-343.9341;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;123;-3504.258,-888.2106;Inherit;False;2;0;INT;1;False;1;INT;0;False;1;INT;0 +Node;AmplifyShaderEditor.SamplerNode;16;-1846.838,725.0273;Inherit;True;Property;_TextureSample3;Texture Sample 3;3;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.NegateNode;29;-1643.534,941.3871;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;25;-1280.839,546.8636;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TexturePropertyNode;14;-2330.879,640.3645;Float;True;Property;_MotionVectors;Motion Vectors;1;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;None;31c1e6c0dea756b498f3977676e82fe0;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.TextureCoordinatesNode;87;-3357.61,-711.0641;Inherit;True;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.FractNode;136;-3601.556,-454.0374;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;110;-3015.726,-758.4483;Inherit;True;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.DynamicAppendNode;138;-3154.993,-313.3108;Inherit;True;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;137;-3802.883,-260.167;Inherit;False;2;0;INT;1;False;1;INT;0;False;1;INT;0 +Node;AmplifyShaderEditor.DynamicAppendNode;112;-2856.368,-941.3546;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;22;-1050.446,714.8672;Inherit;True;2;2;0;FLOAT2;0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;116;-2560.913,-758.7842;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;139;-3331.064,-263.9076;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleAddOpNode;141;-2528.614,-310.7851;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.RangedFloatNode;27;-1936.96,972.8386;Float;False;Property;_UVMotionMultiplier;UV Motion Multiplier;2;0;Create;True;0;0;0;False;0;False;0;0.3333;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.DynamicAppendNode;109;-3508.764,-781.7744;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;97;-3755.8,-1277.217;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FractNode;145;-4473.97,-774.8016;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.WireNode;144;-4298.254,-173.5045;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FloorOpNode;140;-3862.423,-642.1724;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;24;-1432.981,903.9144;Float;False;Constant;_Float0;Float 0;3;0;Create;True;0;0;0;False;0;False;-1;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;122;-3032.439,-891.9513;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TemplateFragmentDataNode;51;-1403.448,2073.357;Inherit;False;0;0;clipPos;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleDivideOpNode;132;-3747.082,-538.6045;Inherit;False;2;0;FLOAT;0;False;1;INT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;2;-678.4235,55.06132;Inherit;True;Property;_TextureSample1;Texture Sample 1;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;1;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.DynamicAppendNode;161;-230.6864,856.9611;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.SimpleDivideOpNode;157;-248.3076,693.9658;Inherit;False;2;0;FLOAT4;1,1,0,0;False;1;FLOAT4;1,1,0,0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.RelayNode;128;-4229.118,-1366.943;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.ColorNode;34;-232.4293,-591.7642;Float;False;Property;_Color;Color;3;1;[HDR];Create;True;0;0;0;False;0;False;1,1,1,1;11.98431,7.215686,7.215686,1;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;150;202.1852,878.4755;Inherit;False;Property;_BakedEmissionMultiplier;Baked Emission Multiplier;9;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SamplerNode;15;-1852.509,523.3021;Inherit;True;Property;_TextureSample2;Texture Sample 2;3;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;46;-1780.333,1850.196;Inherit;False;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0.5;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.StaticSwitch;72;-1696.876,2002.386;Inherit;False;Property;_ScaleDepthDither;Scale Depth Dither;5;0;Create;True;0;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;True;True;All;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;149;670.2187,553.287;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.TexturePropertyNode;3;-1126.52,-92.10968;Float;True;Property;_MainTex;Main Texture;0;1;[NoScaleOffset];Create;False;0;0;0;False;0;False;None;f1c8d7ce8e192e9479527d433e316ead;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 +Node;AmplifyShaderEditor.GetLocalVarNode;155;-413.2412,875.7895;Inherit;False;153;R;1;0;OBJECT;;False;1;INT;0 +Node;AmplifyShaderEditor.GetLocalVarNode;154;-427.0573,805.1232;Inherit;False;152;C;1;0;OBJECT;;False;1;INT;0 +Node;AmplifyShaderEditor.RegisterLocalVarNode;152;-3868.503,-1183.609;Inherit;False;C;-1;True;1;0;INT;0;False;1;INT;0 +Node;AmplifyShaderEditor.RegisterLocalVarNode;153;-3870.503,-1108.609;Inherit;False;R;-1;True;1;0;INT;0;False;1;INT;0 +Node;AmplifyShaderEditor.IntNode;82;-4107.079,-1259.714;Inherit;False;Property;_Columns;Columns;7;0;Create;True;0;0;0;False;0;False;8;3;False;0;1;INT;0 +Node;AmplifyShaderEditor.IntNode;81;-4098.651,-1157.766;Inherit;False;Property;_Rows;Rows;6;0;Create;True;0;0;0;False;0;False;4;3;False;0;1;INT;0 +Node;AmplifyShaderEditor.TextureCoordinatesNode;156;-118.3516,676.3442;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SamplerNode;148;164.7049,677.165;Inherit;True;Property;_TextureSample5;Texture Sample 1;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;1;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.SimpleSubtractOpNode;20;-1423.579,730.1797;Inherit;False;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.WorldPosInputsNode;147;233.765,-501.9776;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 +Node;AmplifyShaderEditor.RelayNode;80;-1996.481,-208.3555;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;23;-1259.993,871.4675;Inherit;False;4;4;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SwizzleNode;13;345.2293,-211.0839;Inherit;False;FLOAT;3;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.VertexColorNode;12;-194.9611,-405.0289;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.LerpOp;4;-268.9241,21.26115;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 +Node;AmplifyShaderEditor.OneMinusNode;26;-1328.071,670.7819;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TexCoordVertexDataNode;10;-2786.698,1948.91;Inherit;False;1;3;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.RangedFloatNode;48;-1967.657,1960.338;Inherit;False;Constant;_Float1;Float 1;2;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;69;-1824.897,2102.173;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.FunctionNode;47;-1328.923,1845.467;Inherit;False;Depth Offseting;-1;;57;f08568184ae023c44bfc8baedfb827a9;0;2;1;FLOAT;0;False;10;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;52;-1573.019,1856.026;Inherit;False;2;2;0;FLOAT4;1,0,0,0;False;1;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.SamplerNode;1;-677.1238,-142.5386;Inherit;True;Property;_TextureSample0;Texture Sample 0;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 +Node;AmplifyShaderEditor.FunctionNode;146;524.8376,-408.1519;Inherit;False;VolumetricsUnlit;-1;;56;800698b1441791d449f3e84fa3283d1e;0;2;2;FLOAT4;0,0,0,0;False;3;FLOAT3;0,0,0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;11;203.1194,-331.3009;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;1;COLOR;0 +Node;AmplifyShaderEditor.SimpleTimeNode;126;-4463.882,-1438.698;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;50;-2005.851,2048.018;Inherit;False;Property;_Depth;Depth;4;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.RangedFloatNode;173;774.848,-185.9885;Inherit;False;Constant;_Float2;Float 2;11;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 +Node;AmplifyShaderEditor.SimpleMultiplyOpNode;64;-2173.058,2100.61;Inherit;False;2;2;0;INT;64;False;1;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.IntNode;65;-2266.384,2016.9;Inherit;False;Global;NoiseArraySize;NoiseArraySize;2;0;Create;True;0;0;0;False;0;False;64;64;False;0;1;INT;0 +Node;AmplifyShaderEditor.FunctionNode;68;-2079.864,1858.284;Inherit;False;Global Blue Noise Sample;-1;;55;bac712bbbce65c14c9d4cbc808f3d0e0;0;2;8;FLOAT2;0,0;False;10;FLOAT;0;False;1;FLOAT4;0 +Node;AmplifyShaderEditor.RelayNode;78;-2000.405,-5.235178;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;168;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;165;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;166;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;172;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;167;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;169;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormals;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;170;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;164;975.6781,-308.2762;Float;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;2;SLZ/Motion Vector Opaque;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;23;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;1;LightMode=UniversalForward;False;False;0;Hidden/InternalErrorShader;0;0;Standard;47;Workflow;1;0;Surface;0;0; Refraction Model;0;0; Blend;0;0;Two Sided;1;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Transmission;0;0; Transmission Shadow;0.5,False,-1;0;Translucency;0;0; Translucency Strength;1,False,-1;0; Normal Distortion;0.5,False,-1;0; Scattering;2,False,-1;0; Direct;0.9,False,-1;0; Ambient;0.1,False,-1;0; Shadow;0.5,False,-1;0;Cast Shadows;1;0; Use Shadow Threshold;0;0;Receive Shadows;1;0;GPU Instancing;1;0;LOD CrossFade;0;637829811356983843;Built-in Fog;1;0;Lightmaps;1;0;Volumetrics;1;0;Decals;0;0;Screen Space Occlusion;1;0;Light Layers;0;0;_FinalColorxAlpha;0;0;Meta Pass;1;0;GBuffer Pass;0;0;Override Baked GI;0;0;Extra Pre Pass;0;0;DOTS Instancing;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,-1;0; Type;0;0; Tess;16,False,-1;0; Min;10,False,-1;0; Max;25,False,-1;0; Edge Length;16,False,-1;0; Max Displacement;25,False,-1;0;Write Depth;0;0; Early Z;0;0;Vertex Position,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;0;0;Fluorescence;0;0;0;10;False;True;True;True;True;True;True;True;True;True;False;;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;171;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;True;4;d3d11;glcore;gles;gles3;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;163;975.6781,-308.2762;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 +WireConnection;106;0;104;0 +WireConnection;134;0;135;0 +WireConnection;103;0;128;0 +WireConnection;130;0;128;0 +WireConnection;107;0;97;0 +WireConnection;135;0;130;0 +WireConnection;135;1;82;0 +WireConnection;108;0;106;0 +WireConnection;105;0;107;0 +WireConnection;104;0;101;0 +WireConnection;104;1;81;0 +WireConnection;21;0;83;0 +WireConnection;21;1;25;0 +WireConnection;18;0;15;0 +WireConnection;18;1;19;0 +WireConnection;101;0;97;0 +WireConnection;83;0;116;0 +WireConnection;133;0;132;0 +WireConnection;131;0;133;0 +WireConnection;123;1;81;0 +WireConnection;16;0;14;0 +WireConnection;16;1;80;0 +WireConnection;29;0;27;0 +WireConnection;25;0;18;0 +WireConnection;25;1;78;0 +WireConnection;25;2;29;0 +WireConnection;136;0;134;0 +WireConnection;110;0;87;0 +WireConnection;110;1;109;0 +WireConnection;138;0;136;0 +WireConnection;138;1;139;0 +WireConnection;137;1;81;0 +WireConnection;112;0;105;0 +WireConnection;112;1;122;0 +WireConnection;22;0;80;0 +WireConnection;22;1;23;0 +WireConnection;116;0;110;0 +WireConnection;116;1;112;0 +WireConnection;139;0;131;0 +WireConnection;139;1;137;0 +WireConnection;141;0;110;0 +WireConnection;141;1;138;0 +WireConnection;109;0;82;0 +WireConnection;109;1;81;0 +WireConnection;97;0;103;0 +WireConnection;97;1;82;0 +WireConnection;145;0;128;0 +WireConnection;144;0;145;0 +WireConnection;140;0;135;0 +WireConnection;122;0;108;0 +WireConnection;122;1;123;0 +WireConnection;132;0;140;0 +WireConnection;132;1;81;0 +WireConnection;2;0;3;0 +WireConnection;2;1;22;0 +WireConnection;161;0;154;0 +WireConnection;161;1;155;0 +WireConnection;157;1;161;0 +WireConnection;128;0;126;0 +WireConnection;15;0;14;0 +WireConnection;15;1;83;0 +WireConnection;46;0;68;0 +WireConnection;46;1;48;0 +WireConnection;72;1;50;0 +WireConnection;72;0;69;0 +WireConnection;149;0;148;0 +WireConnection;149;1;34;0 +WireConnection;149;2;150;0 +WireConnection;152;0;82;0 +WireConnection;153;0;81;0 +WireConnection;156;0;157;0 +WireConnection;148;0;3;0 +WireConnection;148;1;156;0 +WireConnection;20;0;16;0 +WireConnection;20;1;19;0 +WireConnection;80;0;141;0 +WireConnection;23;0;20;0 +WireConnection;23;1;26;0 +WireConnection;23;2;24;0 +WireConnection;23;3;29;0 +WireConnection;13;0;11;0 +WireConnection;4;0;1;0 +WireConnection;4;1;2;0 +WireConnection;4;2;78;0 +WireConnection;26;0;78;0 +WireConnection;69;0;50;0 +WireConnection;69;1;10;3 +WireConnection;47;1;52;0 +WireConnection;47;10;51;4 +WireConnection;52;0;46;0 +WireConnection;52;1;72;0 +WireConnection;1;0;3;0 +WireConnection;1;1;21;0 +WireConnection;146;2;11;0 +WireConnection;146;3;147;0 +WireConnection;11;0;12;0 +WireConnection;11;1;34;0 +WireConnection;11;2;4;0 +WireConnection;126;0;98;0 +WireConnection;64;0;65;0 +WireConnection;64;1;10;2 +WireConnection;68;10;64;0 +WireConnection;78;0;144;0 +WireConnection;164;0;173;0 +WireConnection;164;2;11;0 +WireConnection;164;3;173;0 +WireConnection;164;4;173;0 +WireConnection;164;5;173;0 +ASEEND*/ +//CHKSM=4D86F0FC2CBB5B4FB3842556164E844DCE2BFAEE \ No newline at end of file diff --git a/Assets/SLZShaders/VR_MotionVectorOpaque.shader.meta b/Assets/SLZShaders/VR_MotionVectorOpaque.shader.meta new file mode 100644 index 0000000..d4f2534 --- /dev/null +++ b/Assets/SLZShaders/VR_MotionVectorOpaque.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 24617ef4b8ecbe74984e0955867cffd4 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SLZShaders/VR_particleMotionVector_nonAmp.shader b/Assets/SLZShaders/VR_particleMotionVector_nonAmp.shader new file mode 100644 index 0000000..95fde4b --- /dev/null +++ b/Assets/SLZShaders/VR_particleMotionVector_nonAmp.shader @@ -0,0 +1,819 @@ +Shader "SLZ/Particle/Motion Vector Billboard Correct Shadows" +{ + Properties + { + [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 + _EmissionColor("Emission Color", Color) = (0,0,0,0) + [NoScaleOffset]_MainTex("Main Texture", 2D) = "white" {} + [NoScaleOffset]_EmissionMap("Emission Texture", 2D) = "white" {} + + [NoScaleOffset]_MotionVectors("Motion Vectors", 2D) = "white" {} + _UVMotionMultiplier("UV Motion Multiplier", Float) = 0 + _Color("Color", Color) = (1,1,1,1) + [Toggle(_BRDFMAP)] BRDFMAP("Enable BRDF map", Float) = 0 + [NoScaleOffset]g_tBRDFMap("BRDF map", 2D) = "white" {} + _Depth("Depth", Float) = 0 + [ASEEnd][Toggle(_SCALEDEPTHDITHER_ON)] _ScaleDepthDither("Scale Depth Dither", Float) = 0 + [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 + { + LOD 0 + Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Transparent" "Queue"="Transparent" } + Cull Back + ZWrite Off + ZTest LEqual + Offset 0 , 0 + AlphaToMask Off + + HLSLINCLUDE + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile + + ENDHLSL + + + Pass + { + + Name "Forward" + Tags { "LightMode"="UniversalForward" } + + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ColorMask RGBA + + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + //#pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_ABSOLUTE_VERTEX_POS 1 + #define ASE_SRP_VERSION 120102 + + + // #pragma multi_compile _ _SCREEN_SPACE_OCCLUSION + #define _DISABLE_LIGHTMAPS + #define _DISABLE_REFLECTIONPROBES + #define _DISABLE_SSAO + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DefaultLitVariants.hlsl" + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_FORWARD + + #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 "Include/Particle/billboard.hlsl" + #define ASE_NEEDS_VERT_POSITION + #define ASE_NEEDS_VERT_NORMAL + #define ASE_NEEDS_FRAG_COLOR + #define ASE_NEEDS_FRAG_SCREEN_POSITION + #pragma shader_feature_local _SCALEDEPTHDITHER_ON + #pragma shader_feature_local_fragment _BRDFMAP + + #ifndef SHADER_API_MOBILE + #define ASE_DEPTH_WRITE_ON + #endif + + struct VertexInput + { + float4 vertex : POSITION; + half3 normal : NORMAL; + half4 tangent : TANGENT; + float4 texcoord : TEXCOORD0; //uv, uv2 + float4 texcoord1 : TEXCOORD1; //anim blend, anim frame, center.xy + float texcoord2 : TEXCOORD2; //center.z + half4 vColor : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + half4 vColor : COLOR; + half4 uv01 : TEXCOORD0; + half3 SH : TEXCOORD1; + half4 fog_x_vLight_rgb : TEXCOORD2; + half4 wNormal_xyz_animBlend_x : TEXCOORD3; + float3 wPos : TEXCOORD4; + float4 pCenter_xyz_animFrame_x : TEXCOORD5; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD6; + #endif + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD7; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD8; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + float4 _EmissionColor; + float _UVMotionMultiplier; + float _Depth; + + CBUFFER_END + Texture2D _MainTex; SamplerState sampler_MainTex; + Texture2D _EmissionMap; SamplerState sampler_EmissionMap; + Texture2D _MotionVectors; SamplerState sampler_MotionVectors; + TEXTURE2D_ARRAY(_SLZ_DitherTex2D); + int NoisePixels; + int _SLZ_TexSel; + int NoiseArraySize; + SAMPLER(sampler_SLZ_DitherTex2D); + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + float3 particleCenter = float3(v.texcoord1.z , v.texcoord1.w , v.texcoord2.x); + v.vertex.xyz = particle_face_camera(v.vertex.xyz , v.normal, particleCenter); + + o.vColor = v.vColor; + o.uv01 = v.texcoord; + + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + o.wPos = positionWS; + + VertexNormalInputs normalInput = GetVertexNormalInputs( v.normal, v.tangent ); + + o.wNormal_xyz_animBlend_x = half4(normalInput.normalWS.xyz, v.texcoord1.x); + o.pCenter_xyz_animFrame_x = float4(v.texcoord1.zw, v.texcoord2.x, v.texcoord1.y); + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + OUTPUT_SH( normalInput.normalWS.xyz, o.SH.xyz ); + #endif + + half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); + + #ifdef ASE_FOG + half fogFactor = ComputeFogFactor( positionCS.z ); + #else + half fogFactor = 0; + #endif + + o.fog_x_vLight_rgb = half4(fogFactor, vertexLight); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + o.clipPos = positionCS; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(positionCS); + #endif + return o; + } + + + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag ( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + + half3 WorldNormal = normalize( IN.wNormal_xyz_animBlend_x.xyz); + + float3 WorldPosition = IN.wPos; + float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 ScreenPos = IN.screenPos; + #endif + + + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + + + half animBlend = IN.wNormal_xyz_animBlend_x.w; + float animFrame = IN.pCenter_xyz_animFrame_x.w; + + float2 motionVectorOffset1 = (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, IN.uv01.xy).rg - 0.5 ) * animBlend * -_UVMotionMultiplier; + float2 motionVectorOffset2 = (SAMPLE_TEXTURE2D( _MotionVectors, sampler_MotionVectors, IN.uv01.zw).rg - 0.5 ) * ( 1.0 - animBlend ) * _UVMotionMultiplier; + + float4 albedo = lerp( SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, IN.uv01.xy + motionVectorOffset1), + SAMPLE_TEXTURE2D( _MainTex, sampler_MainTex, IN.uv01.zw + motionVectorOffset2), animBlend); + albedo = IN.vColor * albedo * _Color; + + float4 emission = lerp( SAMPLE_TEXTURE2D( _EmissionMap, sampler_EmissionMap, IN.uv01.xy + motionVectorOffset1), + SAMPLE_TEXTURE2D( _EmissionMap, sampler_EmissionMap, IN.uv01.zw + motionVectorOffset2), animBlend); + + + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( ScreenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + + + #ifdef _SCALEDEPTHDITHER_ON + float staticSwitch72 = ( _Depth * IN.uv01.z ); + #else + float staticSwitch72 = _Depth; + #endif + float2 depthDitherUV = ase_grabScreenPosNorm.xy * _ScreenParams.xy / NoisePixels; + float depthDitherIndex = fmod((float)_SLZ_TexSel + floor((float)NoiseArraySize * animFrame) , (float)NoiseArraySize); + float clipOffset = (SAMPLE_TEXTURE2D_ARRAY( _SLZ_DitherTex2D, sampler_SLZ_DitherTex2D, depthDitherUV , depthDitherIndex).r - 0.5) * staticSwitch72; + float offsetClipW = ( IN.clipPos.w + clipOffset); + + float3 Albedo = albedo.rgb; + float3 Normal = float3(0, 0, 1); + float3 Emission = (emission*_EmissionColor).rgb; +#if 0 + float3 BakedEmission = 0; +#endif + float3 Specular = 0.5; + float Metallic = 0; + float Smoothness = 0.5; + float Occlusion = 1; + float Alpha = albedo.a; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + float3 BakedGI = 0; + float3 RefractionColor = 1; + float RefractionIndex = 1; + float3 Transmission = 1; + float3 Translucency = 1; + //#ifdef ASE_DEPTH_WRITE_ON + float DepthValue = ( ( 1.0 - ( offsetClipW * _ZBufferParams.w ) ) / ( offsetClipW * _ZBufferParams.z ) ); + //#endif + + #ifdef _CLEARCOAT + float CoatMask = 0; + float CoatSmoothness = 0; + #endif + + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + float depthZ = Linear01Depth(DepthValue, _ZBufferParams) * (_ProjectionParams.z - _ProjectionParams.y) + _ProjectionParams.y; + float3 shadowPos = WorldViewDirection * (depthZ / -(dot(WorldViewDirection, UNITY_MATRIX_V._m20_m21_m22))) + _WorldSpaceCameraPos; + inputData.shadowCoord = TransformWorldToShadowCoord(shadowPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + + + + #ifdef ASE_FOG + inputData.fogCoord = IN.fog_x_vLight_rgb.x; + #endif + + inputData.vertexLighting = IN.fog_x_vLight_rgb.yzw; + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = IN.SH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.SH.xyz, IN.dynamicLightmapUV.xy, IN.vertexSH, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.SH.xy, IN.dynamicLightmapUV.xy, IN.vertexSH , inputData.normalWS); + #endif + + #else + #ifdef LIGHTMAP_ON + float4 encodedGI = SAMPLE_GI_DIR(IN.SH.xy, IN.lightmapUVOrVertexSH.xyz, inputData.normalWS, Smoothness, WorldViewDirection); + inputData.bakedGI = encodedGI.rgb; + float BakedSpecular = encodedGI.w; + + #else + inputData.bakedGI = SAMPLE_GI(IN.SH.xy, IN.SH.xyz, inputData.normalWS); + #endif + #endif + + + + #ifdef _ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = Albedo; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData); + #endif + + half4 color = UniversalFragmentPBR( inputData, surfaceData); + + #ifdef LIGHTMAP_ON + float3 MetalSpec = lerp(kDieletricSpec.rgb, surfaceData.albedo , surfaceData.metallic); + color.rgb += BakedSpecular * surfaceData.occlusion * MetalSpec * inputData.bakedGI.rgb; + #endif + + #ifdef _TRANSMISSION_ASE + { + float shadow = _TransmissionShadow; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; + color.rgb += Albedo * mainTransmission; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; + color.rgb += Albedo * transmission; + } + #endif + } + #endif + + #ifdef _TRANSLUCENCY_ASE + { + float shadow = _TransShadow; + float normal = _TransNormal; + float scattering = _TransScattering; + float direct = _TransDirect; + float ambient = _TransAmbient; + float strength = _TransStrength; + + Light mainLight = GetMainLight( inputData.shadowCoord ); + float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; + mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); + + half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; + half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); + half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * mainTranslucency * strength; + + #ifdef _ADDITIONAL_LIGHTS + int transPixelLightCount = GetAdditionalLightsCount(); + for (int i = 0; i < transPixelLightCount; ++i) + { + Light light = GetAdditionalLight(i, inputData.positionWS); + float3 atten = light.color * light.distanceAttenuation; + atten = lerp( atten, atten * light.shadowAttenuation, shadow ); + + half3 lightDir = light.direction + inputData.normalWS * normal; + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; + color.rgb += Albedo * translucency * strength; + } + #endif + } + #endif + + #ifdef _REFRACTION_ASE + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fog_x_vLight_rgb.x ); + #else + color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, IN.fog_x_vLight_rgb.x); + #endif + #endif + + color = Volumetrics( color, inputData.positionWS); + + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return color; + } + + ENDHLSL + } + + + Pass + { + + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + + #define _NORMAL_DROPOFF_TS 1 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #define ASE_FOG 1 + #pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED + #define ASE_ABSOLUTE_VERTEX_POS 1 + #define ASE_SRP_VERSION 120102 + + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #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 "Include/Particle/billboard.hlsl" + #define ASE_NEEDS_VERT_POSITION + #define ASE_NEEDS_VERT_NORMAL + #pragma shader_feature_local _SCALEDEPTHDITHER_ON + + #ifndef SHADER_API_MOBILE + #define ASE_DEPTH_WRITE_ON + #endif + + + struct VertexInput + { + float4 vertex : POSITION; + float3 ase_normal : NORMAL; + float4 ase_texcoord1 : TEXCOORD1; + float4 ase_texcoord2 : TEXCOORD2; + float4 ase_color : COLOR; + float4 ase_texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 clipPos : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 worldPos : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + float4 ase_color : COLOR; + float4 ase_texcoord2 : TEXCOORD2; + float4 ase_texcoord3 : TEXCOORD3; + float4 ase_texcoord4 : TEXCOORD4; + float4 ase_texcoord5 : TEXCOORD5; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float4 _Color; + float _UVMotionMultiplier; + float _Depth; + #ifdef _TRANSMISSION_ASE + float _TransmissionShadow; + #endif + #ifdef _TRANSLUCENCY_ASE + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef TESSELLATION_ON + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + sampler2D _MainTex; + sampler2D _MotionVectors; + TEXTURE2D_ARRAY(_SLZ_DitherTex2D); + int NoisePixels; + int _SLZ_TexSel; + int NoiseArraySize; + SAMPLER(sampler_SLZ_DitherTex2D); + + + inline float4 ASE_ComputeGrabScreenPos( float4 pos ) + { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos; + o.y = pos.w * 0.5f; + o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; + return o; + } + + + float3 _LightDirection; + float3 _LightPosition; + + VertexOutput VertexFunction( VertexInput v ) + { + VertexOutput o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); + + float4 vertex84 = float4( v.vertex.xyz , 0.0 ); + float3 normal84 = v.ase_normal; + float3 tangent84 = float3( 0,0,0 ); + float3 appendResult88 = (float3(v.ase_texcoord1.z , v.ase_texcoord1.w , v.ase_texcoord2.x)); + float3 center84 = appendResult88; + float3 localparticle_face_camera84 = particle_face_camera( vertex84 , normal84, center84 ); + + float4 ase_clipPos = TransformObjectToHClip((v.vertex).xyz); + float4 screenPos = ComputeScreenPos(ase_clipPos); + o.ase_texcoord5 = screenPos; + + o.ase_color = v.ase_color; + o.ase_texcoord2 = v.ase_texcoord; + o.ase_texcoord3 = v.ase_texcoord1; + o.ase_texcoord4 = v.vertex; + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = localparticle_face_camera84; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + + v.ase_normal = normal84; + + float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + o.worldPos = positionWS; + #endif + float3 normalWS = TransformObjectToWorldDir(v.ase_normal); + + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + + float4 clipPos = ApplySLZShadowBias(positionWS, normalWS, lightDirectionWS); + + #if UNITY_REVERSED_Z + clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #else + clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); + #endif + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = clipPos; + o.shadowCoord = GetShadowCoord( vertexInput ); + #endif + o.clipPos = clipPos; + return o; + } + + VertexOutput vert ( VertexInput v ) + { + return VertexFunction( v ); + } + + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) + #define ASE_SV_DEPTH SV_DepthLessEqual + #else + #define ASE_SV_DEPTH SV_Depth + #endif + + half4 frag( VertexOutput IN + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 WorldPosition = IN.worldPos; + #endif + float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + float2 temp_output_8_0 = (IN.ase_texcoord2).xy; + float4 temp_cast_1 = (0.5).xxxx; + float2 temp_output_9_0 = (IN.ase_texcoord2).zw; + float4 temp_cast_4 = (0.5).xxxx; + float4 lerpResult4 = lerp( tex2D( _MainTex, ( float4( temp_output_8_0, 0.0 , 0.0 ) + ( ( tex2D( _MotionVectors, temp_output_8_0 ) - temp_cast_1 ) * IN.ase_texcoord3.xyz.x * -_UVMotionMultiplier ) ).rg ) , tex2D( _MainTex, ( float4( temp_output_9_0, 0.0 , 0.0 ) + ( ( tex2D( _MotionVectors, temp_output_9_0 ) - temp_cast_4 ) * ( 1.0 - IN.ase_texcoord3.xyz.x ) * -1.0 * -_UVMotionMultiplier ) ).rg ) , IN.ase_texcoord3.xyz.x); + float4 temp_output_11_0 = ( IN.ase_color * lerpResult4 * _Color ); + + float4 unityObjectToClipPos92 = TransformWorldToHClip(TransformObjectToWorld(IN.ase_texcoord4.xyz)); + float4 screenPos = IN.ase_texcoord5; + float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); + float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; + float4 temp_cast_8 = (0.5).xxxx; + #ifdef _SCALEDEPTHDITHER_ON + float staticSwitch72 = ( _Depth * IN.ase_texcoord3.xyz.z ); + #else + float staticSwitch72 = _Depth; + #endif + float temp_output_4_0_g44 = ( unityObjectToClipPos92.w + ( ( SAMPLE_TEXTURE2D_ARRAY( _SLZ_DitherTex2D, sampler_SLZ_DitherTex2D, ( (ase_grabScreenPosNorm).xy * ( (_ScreenParams).xy / NoisePixels ) ),(float)( ( _SLZ_TexSel + (int)( NoiseArraySize * IN.ase_texcoord3.xyz.y ) ) % NoiseArraySize ) ) - temp_cast_8 ) * staticSwitch72 ).r ); + + float Alpha = (temp_output_11_0).a; + float AlphaClipThreshold = 0.5; + float AlphaClipThresholdShadow = 0.5; + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = ( ( 1.0 - ( temp_output_4_0_g44 * _ZBufferParams.w ) ) / ( temp_output_4_0_g44 * _ZBufferParams.z ) ); + #endif + + #ifdef _ALPHATEST_ON + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + return 0; + } + + ENDHLSL + } + + + } + + CustomEditor "UnityEditor.ShaderGraphLitGUI" + Fallback "Hidden/InternalErrorShader" + +} diff --git a/Assets/SLZShaders/VR_particleMotionVector_nonAmp.shader.meta b/Assets/SLZShaders/VR_particleMotionVector_nonAmp.shader.meta new file mode 100644 index 0000000..0d1ee30 --- /dev/null +++ b/Assets/SLZShaders/VR_particleMotionVector_nonAmp.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: a0cae63ef60b7da4f9cb90b8cdb4ce4e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UniversalRenderPipelineGlobalSettings.asset b/Assets/UniversalRenderPipelineGlobalSettings.asset new file mode 100644 index 0000000..a996a2e --- /dev/null +++ b/Assets/UniversalRenderPipelineGlobalSettings.asset @@ -0,0 +1,27 @@ +%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: 2ec995e51a6e251468d2a3fd8a686257, type: 3} + m_Name: UniversalRenderPipelineGlobalSettings + m_EditorClassIdentifier: + k_AssetVersion: 2 + lightLayerName0: Light Layer default + lightLayerName1: Light Layer 1 + lightLayerName2: Light Layer 2 + lightLayerName3: Light Layer 3 + lightLayerName4: Light Layer 4 + lightLayerName5: Light Layer 5 + lightLayerName6: Light Layer 6 + lightLayerName7: Light Layer 7 + m_StripDebugVariants: 1 + m_StripUnusedPostProcessingVariants: 0 + m_StripUnusedVariants: 1 + supportRuntimeDebugDisplay: 0 diff --git a/Assets/UniversalRenderPipelineGlobalSettings.asset.meta b/Assets/UniversalRenderPipelineGlobalSettings.asset.meta new file mode 100644 index 0000000..c885a62 --- /dev/null +++ b/Assets/UniversalRenderPipelineGlobalSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7854839073f855740851081b9422a1bf +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/XR.meta b/Assets/XR.meta new file mode 100644 index 0000000..525e8f6 --- /dev/null +++ b/Assets/XR.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d8699a9a7abaeb84eb5bc4e4284e4b1d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/XR/Loaders.meta b/Assets/XR/Loaders.meta new file mode 100644 index 0000000..9005696 --- /dev/null +++ b/Assets/XR/Loaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 79882b36869a70e4c9d0a6062c840f4f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/XR/Loaders/Mock HMD Loader.asset b/Assets/XR/Loaders/Mock HMD Loader.asset new file mode 100644 index 0000000..f7b4662 --- /dev/null +++ b/Assets/XR/Loaders/Mock HMD Loader.asset @@ -0,0 +1,14 @@ +%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: 0660e8fc444734757ae6f6c40c2d33a0, type: 3} + m_Name: Mock HMD Loader + m_EditorClassIdentifier: diff --git a/Assets/XR/Loaders/Mock HMD Loader.asset.meta b/Assets/XR/Loaders/Mock HMD Loader.asset.meta new file mode 100644 index 0000000..cd7fa28 --- /dev/null +++ b/Assets/XR/Loaders/Mock HMD Loader.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 94c1c13e0ca307641a112478f1e86489 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/XR/Loaders/Oculus Loader.asset b/Assets/XR/Loaders/Oculus Loader.asset new file mode 100644 index 0000000..0f89c61 --- /dev/null +++ b/Assets/XR/Loaders/Oculus Loader.asset @@ -0,0 +1,14 @@ +%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: 03bc68f14d65e7747a59d5ff74bd199b, type: 3} + m_Name: Oculus Loader + m_EditorClassIdentifier: diff --git a/Assets/XR/Loaders/Oculus Loader.asset.meta b/Assets/XR/Loaders/Oculus Loader.asset.meta new file mode 100644 index 0000000..032839a --- /dev/null +++ b/Assets/XR/Loaders/Oculus Loader.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 42bf042a97611234f8a0eee870b1a8bd +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/XR/Settings.meta b/Assets/XR/Settings.meta new file mode 100644 index 0000000..a2cbfc2 --- /dev/null +++ b/Assets/XR/Settings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b417fca445d008e468f7d432454f9acb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/XR/Settings/Mock HMD Build Settings.asset b/Assets/XR/Settings/Mock HMD Build Settings.asset new file mode 100644 index 0000000..5cd2a32 --- /dev/null +++ b/Assets/XR/Settings/Mock HMD Build Settings.asset @@ -0,0 +1,15 @@ +%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: c8bf066bf8a4947a1be502d267edb82f, type: 3} + m_Name: Mock HMD Build Settings + m_EditorClassIdentifier: + renderMode: 0 diff --git a/Assets/XR/Settings/Mock HMD Build Settings.asset.meta b/Assets/XR/Settings/Mock HMD Build Settings.asset.meta new file mode 100644 index 0000000..bfd7d65 --- /dev/null +++ b/Assets/XR/Settings/Mock HMD Build Settings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b2a4c4ca45f66ab46b68acaf4c7d7cc7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/XR/Settings/Oculus Settings.asset b/Assets/XR/Settings/Oculus Settings.asset new file mode 100644 index 0000000..e8e1556 --- /dev/null +++ b/Assets/XR/Settings/Oculus Settings.asset @@ -0,0 +1,32 @@ +%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: c353a8f1e58cf884584123914fe63cd5, type: 3} + m_Name: Oculus Settings + m_EditorClassIdentifier: + m_StereoRenderingModeDesktop: 1 + m_StereoRenderingModeAndroid: 2 + SharedDepthBuffer: 1 + DepthSubmission: 0 + DashSupport: 1 + LowOverheadMode: 0 + OptimizeBufferDiscards: 1 + PhaseSync: 0 + SymmetricProjection: 1 + SubsampledLayout: 0 + FoveatedRenderingMethod: 0 + LateLatching: 0 + LateLatchingDebug: 0 + EnableTrackingOriginStageMode: 0 + SpaceWarp: 0 + TargetQuest2: 1 + TargetQuestPro: 0 + SystemSplashScreen: {fileID: 0} diff --git a/Assets/XR/Settings/Oculus Settings.asset.meta b/Assets/XR/Settings/Oculus Settings.asset.meta new file mode 100644 index 0000000..000b70d --- /dev/null +++ b/Assets/XR/Settings/Oculus Settings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a0dfbe9a305809e40aa18a1190f5bfd6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_MarrowAssets.meta b/Assets/_MarrowAssets.meta new file mode 100644 index 0000000..4d12b2c --- /dev/null +++ b/Assets/_MarrowAssets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6d0b7f6fdbb1e914eba5a6e9d497cded +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_MarrowAssets/Settings.meta b/Assets/_MarrowAssets/Settings.meta new file mode 100644 index 0000000..6addfef --- /dev/null +++ b/Assets/_MarrowAssets/Settings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ecc6abee2b2a57e4896f8052a7b49b97 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_MarrowAssets/Settings/TextureStreamSettings.asset b/Assets/_MarrowAssets/Settings/TextureStreamSettings.asset new file mode 100644 index 0000000..6e53644 --- /dev/null +++ b/Assets/_MarrowAssets/Settings/TextureStreamSettings.asset @@ -0,0 +1,15 @@ +%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: c5a52cb3bad3437c9362b8e7e9cd9423, type: 3} + m_Name: TextureStreamSettings + m_EditorClassIdentifier: + textureStreamingPreventionGuidsList: [] diff --git a/Assets/_MarrowAssets/Settings/TextureStreamSettings.asset.meta b/Assets/_MarrowAssets/Settings/TextureStreamSettings.asset.meta new file mode 100644 index 0000000..2052975 --- /dev/null +++ b/Assets/_MarrowAssets/Settings/TextureStreamSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 16b8630143bcfc74c898426ff996bb86 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/ShaderGraphSettings.asset b/ProjectSettings/ShaderGraphSettings.asset new file mode 100644 index 0000000..9b28428 --- /dev/null +++ b/ProjectSettings/ShaderGraphSettings.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + 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: de02f9e1d18f588468e474319d09a723, type: 3} + m_Name: + m_EditorClassIdentifier: + customInterpolatorErrorThreshold: 32 + customInterpolatorWarningThreshold: 16 diff --git a/ProjectSettings/TimelineSettings.asset b/ProjectSettings/TimelineSettings.asset new file mode 100644 index 0000000..cfaebd7 --- /dev/null +++ b/ProjectSettings/TimelineSettings.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + 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: a287be6c49135cd4f9b2b8666c39d999, type: 3} + m_Name: + m_EditorClassIdentifier: + assetDefaultFramerate: 60 + m_DefaultFrameRate: 60 diff --git a/ProjectSettings/URPProjectSettings.asset b/ProjectSettings/URPProjectSettings.asset new file mode 100644 index 0000000..c1f118a --- /dev/null +++ b/ProjectSettings/URPProjectSettings.asset @@ -0,0 +1,15 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + 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: 247994e1f5a72c2419c26a37e9334c01, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LastMaterialVersion: 5 diff --git a/ProjectSettings/XRPackageSettings.asset b/ProjectSettings/XRPackageSettings.asset new file mode 100644 index 0000000..7e791e1 --- /dev/null +++ b/ProjectSettings/XRPackageSettings.asset @@ -0,0 +1,5 @@ +{ + "m_Settings": [ + "RemoveLegacyInputHelpersForReload" + ] +} \ No newline at end of file