diff --git a/Assets/External/Beautify.meta b/Assets/External/Beautify.meta new file mode 100644 index 00000000..40edf23e --- /dev/null +++ b/Assets/External/Beautify.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 25653edf656e24d20881aa2dfcc3c1f8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP.meta b/Assets/External/Beautify/URP.meta new file mode 100644 index 00000000..232fe93d --- /dev/null +++ b/Assets/External/Beautify/URP.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f9961d11e2134c169394003911b1353 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo.meta b/Assets/External/Beautify/URP/Demo.meta new file mode 100644 index 00000000..e37973a8 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7da73911376c04403a2c651fb4ed8db4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources.meta b/Assets/External/Beautify/URP/Demo/DemoSources.meta new file mode 100644 index 00000000..328fd2f4 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 777e31ef507ec4febb92b6688c89a9e3 +folderAsset: yes +timeCreated: 1462519607 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials.meta new file mode 100644 index 00000000..f286fd4c --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 157f5f4e06c7e41c89fbb4f9fbdeb27b +folderAsset: yes +timeCreated: 1465307842 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BluishEmissive.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BluishEmissive.mat new file mode 100644 index 00000000..74b47aa6 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BluishEmissive.mat @@ -0,0 +1,139 @@ +%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: BluishEmissive + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0, g: 0.5137931, b: 1, a: 1} + - _Color: {r: 0, g: 0.5137931, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0.5187909, b: 1.4934778, a: 1} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &459922976277588049 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BluishEmissive.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BluishEmissive.mat.meta new file mode 100644 index 00000000..ad1f9246 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BluishEmissive.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f665cbb95d06419dab6831f996994ae +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightBlueEmissive.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightBlueEmissive.mat new file mode 100644 index 00000000..56d37926 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightBlueEmissive.mat @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-5499540237844167067 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BrightBlueEmissive + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.5137987, g: 0.5137987, b: 1, a: 1} + - _Color: {r: 0.5137987, g: 0.5137987, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 11.211581, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightBlueEmissive.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightBlueEmissive.mat.meta new file mode 100644 index 00000000..c6f3651d --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightBlueEmissive.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0067d374af558414bb48e3b34a1c2323 +timeCreated: 1478863058 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightRedEmissive.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightRedEmissive.mat new file mode 100644 index 00000000..f7f12149 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightRedEmissive.mat @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-1699392176167857644 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BrightRedEmissive + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 3 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 0.5138042, b: 0.5137254, a: 1} + - _Color: {r: 1, g: 0.51380414, b: 0.51372534, a: 1} + - _EmissionColor: {r: 11.211583, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightRedEmissive.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightRedEmissive.mat.meta new file mode 100644 index 00000000..f1cd75f5 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightRedEmissive.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aa631c03375c24c4cbe310de744f058f +timeCreated: 1478863141 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightWhiteEmissive.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightWhiteEmissive.mat new file mode 100644 index 00000000..d6d1992b --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightWhiteEmissive.mat @@ -0,0 +1,139 @@ +%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: BrightWhiteEmissive + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.5137931, g: 0.5137931, b: 0.5137931, a: 1} + - _Color: {r: 0.5137931, g: 0.5137931, b: 0.5137931, a: 1} + - _EmissionColor: {r: 11.211579, g: 11.211579, b: 11.211579, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &6085971584056948090 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightWhiteEmissive.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightWhiteEmissive.mat.meta new file mode 100644 index 00000000..0c4c4817 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/BrightWhiteEmissive.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0fd2d801240046b7b673468d8a86e6f +timeCreated: 1475946238 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/GreenEmissive.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/GreenEmissive.mat new file mode 100644 index 00000000..7fa5c40a --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/GreenEmissive.mat @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3247939049424181077 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: GreenEmissive + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0, g: 0.509, b: 0, a: 1} + - _Color: {r: 0, g: 0.50899994, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 1, b: 0, a: 1} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/GreenEmissive.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/GreenEmissive.mat.meta new file mode 100644 index 00000000..2098a235 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/GreenEmissive.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dc62823918da4474aa9e1f0ac5dda8e7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Quad.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Quad.mat new file mode 100644 index 00000000..5c6723cc --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Quad.mat @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-5045325534731926743 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Quad + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 557dec91771464758a75e390f553373d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 557dec91771464758a75e390f553373d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.2 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _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} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Quad.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Quad.mat.meta new file mode 100644 index 00000000..9f964858 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Quad.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 50867211f1c3a4f4d873b9e9a2345b09 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/ReddishEmissive.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/ReddishEmissive.mat new file mode 100644 index 00000000..3d0d32ab --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/ReddishEmissive.mat @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-9038392548793152760 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ReddishEmissive + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 0.78431374, b: 0, a: 1} + - _Color: {r: 1, g: 0.78431374, b: 0, a: 1} + - _EmissionColor: {r: 4.594794, g: 0.10287979, b: 0, a: 1} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/ReddishEmissive.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/ReddishEmissive.mat.meta new file mode 100644 index 00000000..9acbcf21 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/ReddishEmissive.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 520cb4efa7fe74af489b70716d3ad15d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Skybox.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Skybox.mat new file mode 100644 index 00000000..2f837e71 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Skybox.mat @@ -0,0 +1,103 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Skybox + m_Shader: {fileID: 104, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BackTex: + m_Texture: {fileID: 2800000, guid: cc9e016a2e3f0450fac218857a5735a5, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DownTex: + m_Texture: {fileID: 2800000, guid: f560d74ff147f42f59dae87bed823663, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FrontTex: + m_Texture: {fileID: 2800000, guid: 58e8bd7fe81bc4bdfaa0aca16a4fbfd9, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _LeftTex: + m_Texture: {fileID: 2800000, guid: dda2e23fd5b2b455aa17ca42de02ee8f, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _RightTex: + m_Texture: {fileID: 2800000, guid: fb85cc19dc8f0487a8577530b89b48ec, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Tex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _UpTex: + m_Texture: {fileID: 2800000, guid: 21beb9f9536cc42798b5eec3b533de67, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _Exposure: 1.06 + - _Glossiness: 0.5 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Rotation: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _Tint: {r: 0.472, g: 0.478, b: 0.478, a: 0.497} diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Skybox.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Skybox.mat.meta new file mode 100644 index 00000000..d02c69ec --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/Skybox.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4df845aa63d7e4feab9be5b658f46012 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StonePath.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StonePath.mat new file mode 100644 index 00000000..72ca262c --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StonePath.mat @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4843335661373119716 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: StonePath + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 6 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 557dec91771464758a75e390f553373d, type: 3} + m_Scale: {x: 2, y: 20} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 2, y: 20} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 557dec91771464758a75e390f553373d, type: 3} + m_Scale: {x: 2, y: 20} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.2 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.2 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _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} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StonePath.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StonePath.mat.meta new file mode 100644 index 00000000..38a61da1 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StonePath.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a3446cf188dca4f6a973eeb8189308f6 +timeCreated: 1475679226 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StoneWall.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StoneWall.mat new file mode 100644 index 00000000..1fb52a46 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StoneWall.mat @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3063801942314024869 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: StoneWall + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 557dec91771464758a75e390f553373d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 557dec91771464758a75e390f553373d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.2 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.2 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _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} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StoneWall.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StoneWall.mat.meta new file mode 100644 index 00000000..89b0a703 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/StoneWall.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 16548db57056b4eeeb9bc551b18be0c7 +timeCreated: 1466521213 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/WhiteEmissive.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/WhiteEmissive.mat new file mode 100644 index 00000000..6cf3c148 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/WhiteEmissive.mat @@ -0,0 +1,139 @@ +%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: WhiteEmissive + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 3 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.5137931, g: 0.5137931, b: 0.5137931, a: 1} + - _Color: {r: 0.5137931, g: 0.5137931, b: 0.5137931, a: 1} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &5224656851961784243 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/WhiteEmissive.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/WhiteEmissive.mat.meta new file mode 100644 index 00000000..6dd1ac69 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/WhiteEmissive.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3d58c6582090747c18f4f2c1f5d50217 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/YellowEmissive.mat b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/YellowEmissive.mat new file mode 100644 index 00000000..e21f668e --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/YellowEmissive.mat @@ -0,0 +1,139 @@ +%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: YellowEmissive + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.5137931, g: 0.5137931, b: 0, a: 1} + - _Color: {r: 0.5137931, g: 0.5137931, b: 0, a: 1} + - _EmissionColor: {r: 1, g: 1, b: 0, a: 1} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &170394318617756494 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Materials/YellowEmissive.mat.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/YellowEmissive.mat.meta new file mode 100644 index 00000000..f22796c6 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Materials/YellowEmissive.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 62fe9ccaa47394d74846e9604ac9c017 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Profile.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Profile.meta new file mode 100644 index 00000000..955cfec6 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Profile.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d503132152f524b7aa507d8e1cab8f72 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo DoF Profile.asset b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo DoF Profile.asset new file mode 100644 index 00000000..2df984a1 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo DoF Profile.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:baaa9c72c5151914742a47805edeb398492746d1b5bf9e55623b3516d28da558 +size 17903 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo DoF Profile.asset.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo DoF Profile.asset.meta new file mode 100644 index 00000000..c67ff21c --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo DoF Profile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a59933bb51f9e4053b410799bc308dfc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo Profile.asset b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo Profile.asset new file mode 100644 index 00000000..59fae728 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo Profile.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f1d327d279d1a7d967224fc0c4543146565ddd808b9f5fe0253e91fa4a0cefe +size 17581 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo Profile.asset.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo Profile.asset.meta new file mode 100644 index 00000000..43c1b29f --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/Demo Profile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: efb0a5dc71c424fabaae788534da781f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Profile/LUT Blending Volume.asset b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/LUT Blending Volume.asset new file mode 100644 index 00000000..249b1d93 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/LUT Blending Volume.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e54bf7113092893991b9b1948a9fd385387ca0b2fec196abfd84299971d3ff5 +size 13421 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Profile/LUT Blending Volume.asset.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/LUT Blending Volume.asset.meta new file mode 100644 index 00000000..0fa9ff9c --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Profile/LUT Blending Volume.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 69e5c7e5562824986a4843d89a95675f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts.meta new file mode 100644 index 00000000..52fcd535 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b9984c554d6454839869def79e7b50ac +folderAsset: yes +timeCreated: 1472709933 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/CameraAnimator.cs b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/CameraAnimator.cs new file mode 100644 index 00000000..fc9e309a --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/CameraAnimator.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace Beautify.Universal { + public class CameraAnimator : MonoBehaviour { + void Update() { + transform.Rotate(new Vector3(0, 0, Time.deltaTime * 10f)); + + } + } +} \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/CameraAnimator.cs.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/CameraAnimator.cs.meta new file mode 100644 index 00000000..f41c4be4 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/CameraAnimator.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 883e769c58c564fb69c4a777b7280035 +timeCreated: 1473950280 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/Demo.cs b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/Demo.cs new file mode 100644 index 00000000..aa2ec2ae --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/Demo.cs @@ -0,0 +1,105 @@ +using UnityEngine; +using UnityEngine.UI; +using Beautify.Universal; + +namespace Beautify.Demos { + + public class Demo : MonoBehaviour { + + public Texture lutTexture; + + private void Start() { + UpdateText(); + } + + void Update() { + if (Input.GetKeyDown(KeyCode.J)) { + BeautifySettings.settings.bloomIntensity.value += 0.1f; + } + if (Input.GetKeyDown(KeyCode.T) || Input.GetMouseButtonDown(0)) { + BeautifySettings.settings.disabled.value = !BeautifySettings.settings.disabled.value; + UpdateText(); + } + if (Input.GetKeyDown(KeyCode.B)) BeautifySettings.Blink(0.2f); + + if (Input.GetKeyDown(KeyCode.C)) { + BeautifySettings.settings.compareMode.value = !BeautifySettings.settings.compareMode.value; + } + + if (Input.GetKeyDown(KeyCode.N)) { + BeautifySettings.settings.nightVision.Override(!BeautifySettings.settings.nightVision.value); + } + + if (Input.GetKeyDown(KeyCode.F)) { + if (BeautifySettings.settings.blurIntensity.overrideState) { + BeautifySettings.settings.blurIntensity.overrideState = false; // disables the override, disabling the blur + } else { + BeautifySettings.settings.blurIntensity.Override(4); // enables the override, activating the effect and enabling the blur + } + } + + if (Input.GetKeyDown(KeyCode.Alpha1)) { + // applies a custom value to brightness + BeautifySettings.settings.brightness.Override(0.1f); + } + if (Input.GetKeyDown(KeyCode.Alpha2)) { + // applies a custom value to brightness + BeautifySettings.settings.brightness.Override(0.5f); + } + if (Input.GetKeyDown(KeyCode.Alpha3)) { + // disables custom value + BeautifySettings.settings.brightness.overrideState = false; + } + + if (Input.GetKeyDown(KeyCode.Alpha4)) { + // enables outline + BeautifySettings.settings.outline.Override(true); + BeautifySettings.settings.outlineColor.Override(Color.cyan); + BeautifySettings.settings.outlineCustomize.Override(true); + BeautifySettings.settings.outlineSpread.Override(1.5f); + } + + if (Input.GetKeyDown(KeyCode.Alpha5)) { + // disables outline + BeautifySettings.settings.outline.overrideState = false; + } + + if (Input.GetKeyDown(KeyCode.Alpha6)) { + // assigns a LUT + BeautifySettings.settings.lut.Override(true); + BeautifySettings.settings.lutIntensity.Override(1f); + BeautifySettings.settings.lutTexture.Override(lutTexture); + } + + if (Input.GetKeyDown(KeyCode.Alpha7)) { + // disables LUT + BeautifySettings.settings.lut.Override(false); + } + + if (Input.GetKeyDown(KeyCode.Alpha8)) { + // toggles anamorphic flares on/off + float intensity = BeautifySettings.settings.anamorphicFlaresIntensity.value; + BeautifySettings.settings.anamorphicFlaresIntensity.Override(intensity > 0 ? 0f: 1f); + } + + if (Input.GetKeyDown(KeyCode.Alpha9)) { + // toggles final blur + float intensity = BeautifySettings.settings.blurIntensity.value; + BeautifySettings.settings.blurIntensity.Override(intensity > 0 ? 0f: 1f); + } + + } + + void UpdateText() { + + if (BeautifySettings.settings.disabled.value) { + GameObject.Find("Beautify").GetComponent().text = "Beautify OFF"; + } else { + GameObject.Find("Beautify").GetComponent().text = "Beautify ON"; + } + + } + + + } +} diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/Demo.cs.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/Demo.cs.meta new file mode 100644 index 00000000..49c08147 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/Demo.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 55731cb165f254154b276c96d6565d4f +timeCreated: 1466520993 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/LUTBlending.cs b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/LUTBlending.cs new file mode 100644 index 00000000..e150a3cf --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/LUTBlending.cs @@ -0,0 +1,68 @@ +using UnityEngine; + +namespace Beautify.Universal { + + [ExecuteInEditMode] + public class LUTBlending : MonoBehaviour { + + public Texture2D LUT1, LUT2; + + [Range(0, 1)] + public float LUT1Intensity = 1f; + + [Range(0, 1)] + public float LUT2Intensity = 1f; + + [Range(0, 1)] + public float phase; + public Shader lerpShader; + + float oldPhase = -1; + RenderTexture rt; + Material lerpMat; + + static class ShaderParams { + public static int LUT2 = Shader.PropertyToID("_LUT2"); + public static int Phase = Shader.PropertyToID("_Phase"); + } + + void OnEnable() { + UpdateBeautifyLUT(); + } + + void OnValidate() { + oldPhase = -1; + UpdateBeautifyLUT(); + } + + private void OnDestroy() { + if (rt != null) { + rt.Release(); + } + } + + void LateUpdate() { + UpdateBeautifyLUT(); + } + + void UpdateBeautifyLUT() { + if (oldPhase == phase || LUT1 == null || LUT2 == null || lerpShader == null) return; + oldPhase = phase; + + if (rt == null) { + rt = new RenderTexture(LUT1.width, LUT1.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); + rt.filterMode = FilterMode.Point; + } + if (lerpMat == null) { + lerpMat = new Material(lerpShader); + } + lerpMat.SetTexture(ShaderParams.LUT2, LUT2); + lerpMat.SetFloat(ShaderParams.Phase, phase); + Graphics.Blit(LUT1, rt, lerpMat); + BeautifySettings.settings.lut.Override(true); + float intensity = Mathf.Lerp(LUT1Intensity, LUT2Intensity, phase); + BeautifySettings.settings.lutIntensity.Override(intensity); + BeautifySettings.settings.lutTexture.Override(rt); + } + } +} diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/LUTBlending.cs.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/LUTBlending.cs.meta new file mode 100644 index 00000000..83d919fc --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/LUTBlending.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 72980150b63624acfa5f209b9179d99a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/SphereAnimator.cs b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/SphereAnimator.cs new file mode 100644 index 00000000..f8ded8eb --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/SphereAnimator.cs @@ -0,0 +1,26 @@ +using UnityEngine; + + +namespace Beautify.Universal { + + public class SphereAnimator : MonoBehaviour { + + Rigidbody rb; + const float SPEED = 4; + + void Start () { + rb = GetComponent(); + Application.targetFrameRate = 60; + } + + void FixedUpdate () { + if (transform.position.z < 0.5f) { + rb.linearVelocity = Vector3.forward * SPEED; + } + else if (transform.position.z > 8f) { + rb.linearVelocity = Vector3.back * SPEED; + } + } + + } +} \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/SphereAnimator.cs.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/SphereAnimator.cs.meta new file mode 100644 index 00000000..8d5f3e55 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/SphereAnimator.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8eb68b473eb774609b32b2af81f919d9 +timeCreated: 1475946452 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/ToggleDoF.cs b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/ToggleDoF.cs new file mode 100644 index 00000000..00c3f8cf --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/ToggleDoF.cs @@ -0,0 +1,17 @@ +using UnityEngine; +using Beautify.Universal; + +namespace Beautify.Demos { + + public class ToggleDoF : MonoBehaviour { + + void Update() { + if (Input.GetMouseButtonDown(0)) { + // toggles DoF state by overriding the volume property + bool state = BeautifySettings.settings.depthOfField.value; + BeautifySettings.settings.depthOfField.Override(!state); + } + } + + } +} diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/ToggleDoF.cs.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/ToggleDoF.cs.meta new file mode 100644 index 00000000..f7127f04 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Scripts/ToggleDoF.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ff57a37bca097427389e488b81e3df3c +timeCreated: 1466520993 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Shaders.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Shaders.meta new file mode 100644 index 00000000..94214fcc --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d58da3cd0d51744478b373e83ff1598d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Shaders/TextureLerp.shader b/Assets/External/Beautify/URP/Demo/DemoSources/Shaders/TextureLerp.shader new file mode 100644 index 00000000..bd2caafd --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Shaders/TextureLerp.shader @@ -0,0 +1,55 @@ +Shader "Hidden/Kronnect/Beautify/TextureLerp" +{ + Properties + { + [NoScaleOffset] _MainTex ("LUT 1", 2D) = "black" {} + [NoScaleOffset] _LUT2 ("LUT 2", 2D) = "black" {} + _Phase("Phase", Float) = 0 + } + SubShader + { + ZTest Always + ZWrite Off + Cull Off + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + }; + + sampler2D _MainTex, _LUT2; + float _Phase; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = v.uv; + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + half4 lut1 = tex2D(_MainTex, i.uv); + half4 lut2 = tex2D(_LUT2, i.uv); + return lerp(lut1, lut2, _Phase); + } + ENDCG + } + } +} diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Shaders/TextureLerp.shader.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Shaders/TextureLerp.shader.meta new file mode 100644 index 00000000..cab570f8 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Shaders/TextureLerp.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bf13349ccb9934f2c8b81aabc94fe6d7 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox.meta new file mode 100644 index 00000000..5d8fd5d9 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 53a4e416a976b405e9e7e42d0ab0d69a +folderAsset: yes +timeCreated: 1467470052 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/README_SKYBOX.txt b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/README_SKYBOX.txt new file mode 100644 index 00000000..2c07a9d1 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/README_SKYBOX.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f981fef9a2411351eb377abc7b46b7ec07971c6089a619a47668a4eb9a58e7e7 +size 172 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/README_SKYBOX.txt.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/README_SKYBOX.txt.meta new file mode 100644 index 00000000..0e93d2f1 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/README_SKYBOX.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: feae73fb885504a8b8d1e442e8cbd92c +timeCreated: 1467470241 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterBack2048.png b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterBack2048.png new file mode 100644 index 00000000..e6f7413a --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterBack2048.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a888f6f241c6166273de08987214de33b6a8cdf4ee060156443126dd110076c4 +size 5217348 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterBack2048.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterBack2048.png.meta new file mode 100644 index 00000000..7367ab14 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterBack2048.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: cc9e016a2e3f0450fac218857a5735a5 +timeCreated: 1467470959 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterDown2048.png b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterDown2048.png new file mode 100644 index 00000000..76abd292 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterDown2048.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:161814f0812f07c5bc0ecb7c2f06f3c5de439696b132b1d220c32ed8b37cf101 +size 3754196 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterDown2048.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterDown2048.png.meta new file mode 100644 index 00000000..01d8bdb5 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterDown2048.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: f560d74ff147f42f59dae87bed823663 +timeCreated: 1467470971 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterFront2048.png b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterFront2048.png new file mode 100644 index 00000000..4b3b9580 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterFront2048.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79b8df42b8bfad1b980078a5c2c583bc2657eb6d768720f641b76dd3f17fab2f +size 4947601 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterFront2048.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterFront2048.png.meta new file mode 100644 index 00000000..8e86906e --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterFront2048.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 58e8bd7fe81bc4bdfaa0aca16a4fbfd9 +timeCreated: 1467470953 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterLeft2048.png b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterLeft2048.png new file mode 100644 index 00000000..ba8a816a --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterLeft2048.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:813fe80e992ee81c6109a4ca0c58d2bde4bdbde35696deef1b41d3a346bb805d +size 4621855 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterLeft2048.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterLeft2048.png.meta new file mode 100644 index 00000000..e16f4a42 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterLeft2048.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: dda2e23fd5b2b455aa17ca42de02ee8f +timeCreated: 1467470966 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterRight2048.png b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterRight2048.png new file mode 100644 index 00000000..08bdca12 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterRight2048.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:693bb702354f1d32a6ff3688ccbfcf36afe272989b6a8e7a9015935bcb63ca48 +size 4815657 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterRight2048.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterRight2048.png.meta new file mode 100644 index 00000000..5e09e13c --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterRight2048.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: fb85cc19dc8f0487a8577530b89b48ec +timeCreated: 1467470978 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterUp2048.png b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterUp2048.png new file mode 100644 index 00000000..a45e9556 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterUp2048.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf433d45393ef6902209d5b71615711b0c4369118f96fc64c7bf69e1e8fae64d +size 2483259 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterUp2048.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterUp2048.png.meta new file mode 100644 index 00000000..69420065 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Skybox/ThickCloudsWaterUp2048.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 21beb9f9536cc42798b5eec3b533de67 +timeCreated: 1467470948 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures.meta new file mode 100644 index 00000000..ecf77adf --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d4c7d09cb0ee04ac9a14092b9c872cb3 +folderAsset: yes +timeCreated: 1462519607 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTNeutral.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTNeutral.png new file mode 100644 index 00000000..e2a3bc34 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTNeutral.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6cdd1893b5513c9cf40354b68aacf4d5970c41272d62dec655ff8a12a8aa8cae +size 849 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTNeutral.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTNeutral.png.meta new file mode 100644 index 00000000..0224e8ec --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTNeutral.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: c75e186435cf24b06ba55bc1c1999a6f +timeCreated: 1554296498 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 0 + mipBias: -1 + 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} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTSepia.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTSepia.png new file mode 100644 index 00000000..45258084 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTSepia.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b5501590e5e555d34a6ec7caf2ea7927462b0a1ad2506ddbbbecc6e9b8cb18a +size 24649 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTSepia.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTSepia.png.meta new file mode 100644 index 00000000..07611fe2 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUTSepia.png.meta @@ -0,0 +1,112 @@ +fileFormatVersion: 2 +guid: b8fc4d47ab82140b6add161a4d3ea695 +timeCreated: 1523525482 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 1 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 0 + mipBias: -1 + 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} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: iPhone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: WebGL + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_18.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_18.png new file mode 100644 index 00000000..684558c7 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_18.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c8c9b2c6916bbeaeb412063a6711ce829c50f7f1440860a1418de05b988cb4d +size 77293 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_18.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_18.png.meta new file mode 100644 index 00000000..db501f63 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_18.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: 91e50ab11e3e040b289162f90a6efba5 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 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 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + 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: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + 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: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_2400.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_2400.png new file mode 100644 index 00000000..7e186333 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_2400.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:132f79b8d85da86b38cc391a8be51f89a62bb5e823ea5e0fe21c4943e004933a +size 54884 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_2400.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_2400.png.meta new file mode 100644 index 00000000..f30721e0 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/LUT_2400.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: cb660b42a27954f348c1567c26aaf7c9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 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 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + 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: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + 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: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt.png new file mode 100644 index 00000000..a977cbc2 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dd2ede18800c5ea6d9b2c6cabdb65076cd01eb4f8fcddb592c1a2162d6cb491 +size 2657976 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt.png.meta new file mode 100644 index 00000000..a1e1f1e3 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: 557dec91771464758a75e390f553373d +timeCreated: 1466508776 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + 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: 1 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + 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} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt1.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt1.png new file mode 100644 index 00000000..e5d01c57 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0442ea88aa4137ea080744f86cb2832243d8cf4b7c2444246bc76788f9ea465e +size 739952 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt1.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt1.png.meta new file mode 100644 index 00000000..b31d0437 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt1.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 497391d2b220f4b588c8707828d383fc +timeCreated: 1532083477 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + 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} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt2.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt2.png new file mode 100644 index 00000000..f56cce02 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63fb35c8c904efd605a748c842ff9d9016329fc7e7710257ae292dcbc9b5693c +size 473839 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt2.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt2.png.meta new file mode 100644 index 00000000..72ad578f --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt2.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: f5c5080de097a4274bab7bc2bf5017f6 +timeCreated: 1532083478 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + 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} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt3.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt3.png new file mode 100644 index 00000000..83f26b1f --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2a673dea55438fde2099f21ba5ca77e7802cce769c26fb0e5a5b0639507dee0 +size 245359 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt3.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt3.png.meta new file mode 100644 index 00000000..d088bc59 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt3.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 1eaf49009b12743098441114b5bd333f +timeCreated: 1532083477 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + 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} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt4.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt4.png new file mode 100644 index 00000000..f4afc8d7 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0428669a1856f15129bea80a5f0a489a6583b61b636f32e7535e4b81179cb88 +size 819335 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt4.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt4.png.meta new file mode 100644 index 00000000..360df1cb --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt4.png.meta @@ -0,0 +1,59 @@ +fileFormatVersion: 2 +guid: 3ffe6b2509a2b4ecfa7fbb37186a72c8 +timeCreated: 1472116391 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt5.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt5.png new file mode 100644 index 00000000..37668a29 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4acfedb8158679bd820e7c1cb1d6bc304d1d9de4b038aea06e29f65a8333dd1 +size 818969 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt5.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt5.png.meta new file mode 100644 index 00000000..b029e8b0 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/dirt5.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: c51ac95356f5b4a129042df08e58c84d +timeCreated: 1532083478 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + 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} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/grungeBorder.png b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/grungeBorder.png new file mode 100644 index 00000000..09e42052 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/grungeBorder.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:570fe884dfa8e06bb9519928f1fdef2fbb85e71da216ce93b31502793306761f +size 507814 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/Textures/grungeBorder.png.meta b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/grungeBorder.png.meta new file mode 100644 index 00000000..23b4d4d4 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/Textures/grungeBorder.png.meta @@ -0,0 +1,91 @@ +fileFormatVersion: 2 +guid: 6f065cb5a39224347be7a897eb4fbe55 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + 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 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings.meta b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings.meta new file mode 100644 index 00000000..6b8eab93 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f9d7789006c24be5a03db2ac214a6a9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset.asset b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset.asset new file mode 100644 index 00000000..ccb1b696 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00572981dae4079a39a522da4f7fe5f2a472a0763f0fcd5e3448ca4ee0208b0f +size 4421 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset.asset.meta b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset.asset.meta new file mode 100644 index 00000000..e9bcf43a --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0420a5f7bad574a20bf7ad3eddd45a6d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset_Renderer.asset b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset_Renderer.asset new file mode 100644 index 00000000..19e5991d --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset_Renderer.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02642b948cb4f4b2c33fae5ee98087c54bc9a62a6ee3151be9028e7787085e73 +size 3861 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset_Renderer.asset.meta b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset_Renderer.asset.meta new file mode 100644 index 00000000..952ed010 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineAsset_Renderer.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9f2b19a61cd1c4f9d9720feb89e96e43 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineGlobalSettings.asset b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineGlobalSettings.asset new file mode 100644 index 00000000..04f89c3d --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineGlobalSettings.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1a6495398d12a382182677dd9d5a72ff963e66cd8b17fe3987f3f0e4b7d0eab +size 842 diff --git a/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineGlobalSettings.asset.meta b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineGlobalSettings.asset.meta new file mode 100644 index 00000000..c6e5224a --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/DemoSources/URP Settings/UniversalRenderPipelineGlobalSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc13ffe5b64b54ad2a9e37168350312c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/Scene.unity b/Assets/External/Beautify/URP/Demo/Scene.unity new file mode 100644 index 00000000..be0aee80 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/Scene.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15e294202e000c586df373a494088fe301c8e4d9c42f7b07b05f20a59fad5d35 +size 42126 diff --git a/Assets/External/Beautify/URP/Demo/Scene.unity.meta b/Assets/External/Beautify/URP/Demo/Scene.unity.meta new file mode 100644 index 00000000..1d31065f --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/Scene.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 676780d52cde7471f8536d9000b39b80 +timeCreated: 1487074764 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/Scene_DepthOfField.unity b/Assets/External/Beautify/URP/Demo/Scene_DepthOfField.unity new file mode 100644 index 00000000..76920a6a --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/Scene_DepthOfField.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebebecbb4df55e3c7a9286680c2c36afd3e86b6e80f3cc11437adb2408a3a323 +size 66464 diff --git a/Assets/External/Beautify/URP/Demo/Scene_DepthOfField.unity.meta b/Assets/External/Beautify/URP/Demo/Scene_DepthOfField.unity.meta new file mode 100644 index 00000000..7e4d994d --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/Scene_DepthOfField.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5b607301e68434e6e90ec78a5b0bcc39 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Demo/Scene_LUTBlending.unity b/Assets/External/Beautify/URP/Demo/Scene_LUTBlending.unity new file mode 100644 index 00000000..7ec68948 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/Scene_LUTBlending.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62f095a5c8105c2fcd17843b87edc32f14db96689eb7993d9a45cd7ab9eea1dc +size 23402 diff --git a/Assets/External/Beautify/URP/Demo/Scene_LUTBlending.unity.meta b/Assets/External/Beautify/URP/Demo/Scene_LUTBlending.unity.meta new file mode 100644 index 00000000..ebf27bd0 --- /dev/null +++ b/Assets/External/Beautify/URP/Demo/Scene_LUTBlending.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b41fd1587d3de4335b76c648ed479ae4 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Documentation.meta b/Assets/External/Beautify/URP/Documentation.meta new file mode 100644 index 00000000..66b09eba --- /dev/null +++ b/Assets/External/Beautify/URP/Documentation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d553524dbeddd471981f0ca82bf35023 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Documentation/Documentation Online.url b/Assets/External/Beautify/URP/Documentation/Documentation Online.url new file mode 100644 index 00000000..04673350 --- /dev/null +++ b/Assets/External/Beautify/URP/Documentation/Documentation Online.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://kronnect.com/guides-category/beautify-2-urp/ \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Documentation/Documentation Online.url.meta b/Assets/External/Beautify/URP/Documentation/Documentation Online.url.meta new file mode 100644 index 00000000..35d7c32b --- /dev/null +++ b/Assets/External/Beautify/URP/Documentation/Documentation Online.url.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8d2b34f62cb244e2d9d69e35ed72fcbd +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Documentation/Documentation PDF.url b/Assets/External/Beautify/URP/Documentation/Documentation PDF.url new file mode 100644 index 00000000..9a49ce00 --- /dev/null +++ b/Assets/External/Beautify/URP/Documentation/Documentation PDF.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://www.dropbox.com/s/npzthxi1kxno4wj/Documentation.pdf?dl=0 \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Documentation/Documentation PDF.url.meta b/Assets/External/Beautify/URP/Documentation/Documentation PDF.url.meta new file mode 100644 index 00000000..05561fba --- /dev/null +++ b/Assets/External/Beautify/URP/Documentation/Documentation PDF.url.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d970b48b366614f60891e6c421ea91cb +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Documentation/Kronnect Assets.url b/Assets/External/Beautify/URP/Documentation/Kronnect Assets.url new file mode 100644 index 00000000..d4772915 --- /dev/null +++ b/Assets/External/Beautify/URP/Documentation/Kronnect Assets.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://kronnect.com \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Documentation/Kronnect Assets.url.meta b/Assets/External/Beautify/URP/Documentation/Kronnect Assets.url.meta new file mode 100644 index 00000000..eb6eee7f --- /dev/null +++ b/Assets/External/Beautify/URP/Documentation/Kronnect Assets.url.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e54c7cadb672b4bda968f03dd63aa4b5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor.meta b/Assets/External/Beautify/URP/Editor.meta new file mode 100644 index 00000000..5d472f57 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e7ebc7ff1cfdf4d54b7c8ce54a032d2f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/BeautifyEditor.cs b/Assets/External/Beautify/URP/Editor/BeautifyEditor.cs new file mode 100644 index 00000000..d11ea656 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/BeautifyEditor.cs @@ -0,0 +1,662 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEditor.Rendering; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +namespace Beautify.Universal { +#if UNITY_2022_2_OR_NEWER + [CustomEditor(typeof(Beautify))] +#else + [VolumeComponentEditor(typeof(Beautify))] +#endif + public class BeautifyEditor : VolumeComponentEditor { + + Beautify beautify; + GUIStyle sectionGroupStyle, foldoutStyle, blackBack; + PropertyFetcher propertyFetcher; + Texture2D headerTex; + bool pixelateExpanded; + + // settings group + class SectionContents { + public Dictionary> groups = new Dictionary>(); + public List singleFields = new List(); + } + + readonly Dictionary sections = new Dictionary(); + readonly Dictionary> groupedFields = new Dictionary>(); + readonly Dictionary unpackedFields = new Dictionary(); +#if !UNITY_2021_2_OR_NEWER + public override bool hasAdvancedMode => false; +#endif + + public override void OnEnable () { + base.OnEnable(); + + headerTex = Resources.Load("beautifyHeader"); + blackBack = new GUIStyle(); + blackBack.normal.background = MakeTex(4, 4, Color.black); + blackBack.alignment = TextAnchor.MiddleCenter; + + beautify = (Beautify)target; + + propertyFetcher = new PropertyFetcher(serializedObject); + + // get volume fx settings + var settings = beautify.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) + .Where(t => t.FieldType.IsSubclassOf(typeof(VolumeParameter))) + .Where(t => (t.IsPublic && t.GetCustomAttributes(typeof(NonSerializedAttribute), false).Length == 0) || + (t.GetCustomAttributes(typeof(SerializeField), false).Length > 0)) + .Where(t => t.GetCustomAttributes(typeof(HideInInspector), false).Length == 0) + .Where(t => t.GetCustomAttributes(typeof(Beautify.SectionGroup), false).Any()); + + // group by settings first + unpackedFields.Clear(); + sections.Clear(); + groupedFields.Clear(); + foreach (var setting in settings) { + SectionContents sectionContents = null; + + foreach (var section in setting.GetCustomAttributes(typeof(Beautify.SectionGroup)) as IEnumerable) { + if (!sections.TryGetValue(section, out sectionContents)) { + sectionContents = sections[section] = new SectionContents(); + } + + bool isGrouped = false; + foreach (var settingGroup in setting.GetCustomAttributes(typeof(Beautify.SettingsGroup)) as IEnumerable) { + if (!groupedFields.ContainsKey(settingGroup)) { + sectionContents.groups[settingGroup] = groupedFields[settingGroup] = new List(); + } + groupedFields[settingGroup].Add(setting); + isGrouped = true; + unpackedFields[setting] = Unpack(propertyFetcher.Find(setting.Name)); + } + + if (!isGrouped) { + sectionContents.singleFields.Add(setting); + unpackedFields[setting] = Unpack(propertyFetcher.Find(setting.Name)); + } + } + } + } + + public override void OnDisable() { + EditorApplication.delayCall -= RepaintAllViews; + } + + + public override void OnInspectorGUI () { + + serializedObject.Update(); + + SetStyles(); + + Beautify.TonemapOperator prevTonemap = beautify.tonemap.value; + bool prevDirectWrite = beautify.directWrite.value; + int prevBloomExclusionLayerMask = beautify.bloomExclusionLayerMask.overrideState ? (int)beautify.bloomExclusionLayerMask.value : 0; + int prevAnamorphicFlaresExclusionLayerMask = beautify.anamorphicFlaresExclusionLayerMask.overrideState ? (int)beautify.anamorphicFlaresExclusionLayerMask.value : 0; + + EditorGUILayout.BeginVertical(); + { + GUILayout.BeginHorizontal(blackBack); + GUILayout.Label(headerTex, blackBack, GUILayout.ExpandWidth(true)); + GUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button(new GUIContent("Clear Effects", "Clears all effect overrides"), EditorStyles.miniButton)) { + if (EditorUtility.DisplayDialog("Clear Effects", "Do you want to clear all effects?", "Yes", "Cancel")) { + beautify.sharpenIntensity.overrideState = false; + beautify.antialiasStrength.overrideState = false; + beautify.ditherIntensity.overrideState = false; + beautify.tonemap.overrideState = false; + beautify.saturate.Override(0); + beautify.brightness.overrideState = false; + beautify.contrast.overrideState = false; + beautify.daltonize.overrideState = false; + beautify.sepia.overrideState = false; + beautify.tintColor.overrideState = false; + beautify.colorTemp.overrideState = false; + beautify.colorTempBlend.overrideState = false; + beautify.lut.overrideState = false; + beautify.bloomIntensity.overrideState = false; + beautify.anamorphicFlaresIntensity.overrideState = false; + beautify.sunFlaresIntensity.overrideState = false; + beautify.lensDirtIntensity.overrideState = false; + beautify.chromaticAberrationIntensity.overrideState = false; + beautify.depthOfField.overrideState = false; + beautify.eyeAdaptation.overrideState = false; + beautify.purkinje.overrideState = false; + beautify.vignettingOuterRing.overrideState = false; + beautify.vignettingInnerRing.overrideState = false; + beautify.vignettingFade.overrideState = false; + beautify.vignettingBlink.overrideState = false; + beautify.outline.overrideState = false; + beautify.nightVision.overrideState = false; + beautify.thermalVision.overrideState = false; + beautify.frame.overrideState = false; + beautify.blurIntensity.overrideState = false; + EditorUtility.SetDirty(beautify); + } + } + if (GUILayout.Button(new GUIContent("Quick Settings", "Applies a default set of effects including color improvement, sharpening, vignette and bloom."), EditorStyles.miniButton)) { + if (EditorUtility.DisplayDialog("Quick Settings", "Do you want to apply a collection of example effect settings (including color improvements, dithering, sharpening, vignette and bloom)?\nYou can adjust them later as you wish.", "Yes", "No")) { + beautify.sharpenIntensity.Override(4f); + beautify.ditherIntensity.Override(0.005f); + beautify.brightness.Override(1.05f); + beautify.saturate.Override(1f); + beautify.contrast.Override(1.02f); + beautify.bloomIntensity.Override(0.25f); + beautify.bloomThreshold.Override(0.75f); + beautify.vignettingOuterRing.Override(0.325f); + beautify.vignettingInnerRing.Override(0.925f); + EditorUtility.SetDirty(beautify); + } + } + if (GUILayout.Button("Online Resources & Support")) { + ContactUsWindow.ShowScreen(); + } + EditorGUILayout.EndHorizontal(); + + + UniversalRenderPipelineAsset pipe = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset; + + Camera cam = Camera.main; + if (cam != null) { + UniversalAdditionalCameraData data = cam.GetComponent(); + if (data != null && !data.renderPostProcessing && !BeautifyRendererFeature.ignoringPostProcessingOption) { + EditorGUILayout.HelpBox("Post Processing option is disabled in the camera. Either enable it or enable the option 'Ignore Post Processing Option' in the Beautify Render Feature.", MessageType.Warning); + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Go to Camera")) { + Selection.activeObject = cam; + } + if (GUILayout.Button("Go to Universal Rendering Pipeline Asset")) { + Selection.activeObject = pipe; + } + EditorGUILayout.EndHorizontal(); + EditorGUILayout.Separator(); + } + } + + if (pipe == null) { + EditorGUILayout.HelpBox("Universal Rendering Pipeline asset is not set in 'Project Settings / Graphics' !", MessageType.Error); + EditorGUILayout.Separator(); + GUI.enabled = false; + } + else if (!BeautifyRendererFeature.installed) { + EditorGUILayout.HelpBox("Beautify Render Feature must be added to the rendering pipeline renderer.", MessageType.Error); + if (GUILayout.Button("Go to Universal Rendering Pipeline Asset")) { + Selection.activeObject = pipe; + } + EditorGUILayout.Separator(); + GUI.enabled = false; + } + else if (beautify.RequiresDepthTexture()) { +#if !UNITY_2021_3_OR_NEWER + if (!pipe.supportsCameraDepthTexture) { + EditorGUILayout.HelpBox("Depth Texture option may be required for certain effects. Check Universal Rendering Pipeline asset!", MessageType.Warning); + if (GUILayout.Button("Go to Universal Rendering Pipeline Asset")) { + Selection.activeObject = pipe; + } + EditorGUILayout.Separator(); + } +#endif + } + + bool usesHDREffect = beautify.tonemap.value != Beautify.TonemapOperator.Linear; + if (usesHDREffect && (QualitySettings.activeColorSpace != ColorSpace.Linear || (Camera.main != null && !Camera.main.allowHDR))) { + EditorGUILayout.HelpBox("Some effects, like bloom or tonemapping, works better with Linear Color Space and HDR enabled. Enable Linear color space in Player Settings and check your camera and pipeline HDR setting.", MessageType.Warning); + } + + if ((bool)beautify.directWrite) { +#if !UNITY_2022_3_OR_NEWER + if (UnityEngine.XR.XRSettings.enabled) { + EditorGUILayout.HelpBox("Direct Write To Camera option is not compatible with VR.", MessageType.Warning); + } +#endif + } + + // sections + bool firstSectionDrawn = false; + foreach (var section in sections) { + bool printSectionHeader = true; + + // individual properties + foreach (var field in section.Value.singleFields) { + if (!unpackedFields.TryGetValue(field, out var parameter)) continue; + + if (printSectionHeader) { + GUILayout.Space(6.0f); + Rect rect = GUILayoutUtility.GetRect(16f, 22f, sectionGroupStyle); + GUI.Box(rect, ObjectNames.NicifyVariableName(section.Key.GetType().Name), sectionGroupStyle); + printSectionHeader = false; + } + + bool indent; + if (!IsVisible(parameter, field, out indent)) { + if (field.GetCustomAttribute() != null) { + EditorGUILayout.BeginHorizontal(); + GUI.enabled = false; + DrawPropertyField(parameter, field, indent); + GUILayout.Label("(Not available - Check General Options)"); + GUI.enabled = true; + EditorGUILayout.EndHorizontal(); + } + continue; + } + + var displayName = parameter.displayName; + if (field.GetCustomAttribute(typeof(Beautify.DisplayName)) is Beautify.DisplayName displayNameAttrib) { + displayName = displayNameAttrib.name; + } + + DrawPropertyField(parameter, field, indent); + + if (beautify.disabled.value) GUI.enabled = false; + } + GUILayout.Space(6.0f); + + // grouped properties + foreach (var group in section.Value.groups) { + Beautify.SettingsGroup settingsGroup = group.Key; + string groupName = ObjectNames.NicifyVariableName(settingsGroup.GetType().Name); + bool printGroupFoldout = true; + bool firstField = true; + bool groupHasContent = false; + + foreach (var field in group.Value) { + if (!unpackedFields.TryGetValue(field, out var parameter)) continue; + + if (printSectionHeader) { + GUILayout.Space(6.0f); + Rect rect = GUILayoutUtility.GetRect(16f, 22f, sectionGroupStyle); + GUI.Box(rect, ObjectNames.NicifyVariableName(section.Key.GetType().Name), sectionGroupStyle); + printSectionHeader = false; + } + + bool indent; + if (!IsVisible(parameter, field, out indent)) { + if (firstField) { + if (field.GetCustomAttribute() != null) { + EditorGUILayout.BeginHorizontal(); + GUI.enabled = false; + EditorGUILayout.Foldout(false, groupName, true, foldoutStyle); + GUILayout.FlexibleSpace(); + GUILayout.Label("(Not available - Check General Options)"); + GUI.enabled = true; + EditorGUILayout.EndHorizontal(); + GUILayout.Space(6.0f); + } + break; + } + continue; + } + + firstField = false; + + if (printGroupFoldout) { + printGroupFoldout = false; + settingsGroup.IsExpanded = EditorGUILayout.Foldout(settingsGroup.IsExpanded, groupName, true, foldoutStyle); + if (!settingsGroup.IsExpanded) + break; + } + + DrawPropertyField(parameter, field, indent); + groupHasContent = true; + + if (parameter.value.propertyType == SerializedPropertyType.Boolean) { + if (!parameter.value.boolValue) { + var hasToggleSectionBegin = field.GetCustomAttributes(typeof(Beautify.ToggleAllFields)).Any(); + if (hasToggleSectionBegin) break; + } + } + else if (field.Name.Equals("depthOfFieldFocusMode")) { + if (BeautifySettings.instance != null && BeautifySettings.instance.depthOfFieldTarget == null) { + SerializedProperty prop = serializedObject.FindProperty(field.Name); + if (prop != null) { + var value = prop.FindPropertyRelative("m_Value"); + if (value != null && value.enumValueIndex == (int)Beautify.DoFFocusMode.FollowTarget) { + EditorGUILayout.HelpBox("Assign target in the Beautify Settings component.", MessageType.Info); + } + } + } + } + } + if (groupHasContent) { + GUILayout.Space(6.0f); + } + } + + // Add "Configure Build Settings" button after the first section is fully drawn + if (!firstSectionDrawn) { + string strippedKeywords = PlayerPrefs.GetString(BeautifyRendererFeature.PLAYER_PREF_KEYNAME, ""); + if (string.IsNullOrEmpty(strippedKeywords)) { + EditorGUILayout.HelpBox("All features are currently included in the build, which may significantly increase compilation time. Click the button below to configure and exclude unnecessary features from the build.", MessageType.Warning); + } + if (GUILayout.Button("Configure Build Settings >")) { + SelectActiveURPRendererAsset(); + } + firstSectionDrawn = true; + } + } + } + EditorGUILayout.EndVertical(); + + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(6.0f); + pixelateExpanded = EditorGUILayout.Foldout(pixelateExpanded, "Pixelate", true, foldoutStyle); + EditorGUILayout.EndHorizontal(); + if (pixelateExpanded) { + EditorGUILayout.HelpBox("Use the Downsampling option in General Settings to apply a pixelate effect.", MessageType.Info); + } + + + if (serializedObject.ApplyModifiedProperties()) { + if (beautify.directWrite.value != prevDirectWrite || beautify.bloomExclusionLayerMask != prevBloomExclusionLayerMask || beautify.anamorphicFlaresExclusionLayerMask != prevAnamorphicFlaresExclusionLayerMask || beautify.outline.value) { + EditorApplication.delayCall += RepaintAllViews; + } + } + + if (prevTonemap != beautify.tonemap.value && beautify.tonemap.value != Beautify.TonemapOperator.Linear) { + beautify.saturate.value = 0; + beautify.saturate.overrideState = true; + beautify.contrast.value = 1f; + beautify.contrast.overrideState = true; + } + + } + + static void RepaintAllViews() { + UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); + } + + bool IsVisible (SerializedDataParameter property, MemberInfo field, out bool indent) { + bool visible = true; + indent = false; + + Beautify.DisplayConditionEnum enumCondition = field.GetCustomAttribute(typeof(Beautify.DisplayConditionEnum)) as Beautify.DisplayConditionEnum; + Beautify.DisplayConditionBool boolCondition = field.GetCustomAttribute(typeof(Beautify.DisplayConditionBool)) as Beautify.DisplayConditionBool; + bool isEnumCondition = enumCondition != null; + bool isBoolCondition = boolCondition != null; + bool canIndent = isEnumCondition ^ isBoolCondition; + + if (isEnumCondition) { + SerializedProperty condProp = propertyFetcher.Find(enumCondition.field); + if (condProp != null) { + var value = condProp.FindPropertyRelative("m_Value"); + if (value != null) { + visible = false; + if (enumCondition.isEqual) { + if (value.enumValueIndex == enumCondition.enumValueIndex) { + indent = canIndent; + return true; + } + } + else if (value.enumValueIndex != enumCondition.enumValueIndex) { + indent = canIndent; + return true; + } + } + } + } + /* OR */ + if (isBoolCondition) { + SerializedProperty condProp = propertyFetcher.Find(boolCondition.field); + if (condProp != null) { + var value = condProp.FindPropertyRelative("m_Value"); + if (value != null) { + if (value.boolValue != boolCondition.value) { + return false; + } + indent = value.boolValue; + } + } + /* AND */ + SerializedProperty condProp2 = propertyFetcher.Find(boolCondition.field2); + if (condProp2 != null) { + var value2 = condProp2.FindPropertyRelative("m_Value"); + if (value2 != null) { + if (value2.boolValue != boolCondition.value2) { + return false; + } + indent = indent || value2.boolValue; + } + } + indent &= canIndent; + visible = true; + } + + return visible; + } + + void DrawPropertyField (SerializedDataParameter property, MemberInfo field, bool indent) { + + if (indent) { + EditorGUI.indentLevel++; + } + + var displayName = property.displayName; + if (field.GetCustomAttribute(typeof(Beautify.DisplayName)) is Beautify.DisplayName displayNameAttrib) { + displayName = displayNameAttrib.name; + } + + if (property.value.propertyType == SerializedPropertyType.Boolean) { + + if (field.GetCustomAttribute(typeof(Beautify.GlobalOverride)) != null) { + + BoolParameter pr = property.GetObjectRef(); + bool prev = pr.value; + + using (new EditorGUILayout.HorizontalScope()) { + float w = 17f; + if (EditorGUI.indentLevel > 0) w += 8f; + var overrideRect = GUILayoutUtility.GetRect(w, 20f, GUILayout.ExpandWidth(false)); + overrideRect.yMin += 4f; + if (EditorGUI.indentLevel > 0) { + overrideRect.xMin += 12f; + } + bool value = GUI.Toggle(overrideRect, prev, GUIContent.none); + + string tooltip = null; + if (field.GetCustomAttribute(typeof(TooltipAttribute)) is TooltipAttribute tooltipAttribute) { + tooltip = tooltipAttribute.tooltip; + } + + using (new EditorGUI.DisabledScope(!prev)) { + EditorGUILayout.LabelField(new GUIContent(displayName, tooltip)); + } + + if (value != prev) { + pr.value = value; + SerializedProperty prop = serializedObject.FindProperty(field.Name); + if (prop != null) { + var boolProp = prop.FindPropertyRelative("m_Value"); + if (boolProp != null) { + boolProp.boolValue = value; + } + if (value) { + var overrideProp = prop.FindPropertyRelative("m_OverrideState"); + if (overrideProp != null) { + overrideProp.boolValue = true; + } + } + } + } + } + + } + else { + PropertyField(property, new GUIContent(displayName)); + } + } + else { + PropertyField(property, new GUIContent(displayName)); + } + + if (indent) { + EditorGUI.indentLevel--; + } + + // Add warning messages for stripped features + if (field.GetCustomAttribute() != null) { + + string strippedKeywords = PlayerPrefs.GetString(BeautifyRendererFeature.PLAYER_PREF_KEYNAME, ""); + bool isEnabled = false; + bool isOverridden = property.overrideState.boolValue; + if (isOverridden) { + if (property.value.propertyType == SerializedPropertyType.Boolean) { + isEnabled = property.value.boolValue; + } + else if (property.value.propertyType == SerializedPropertyType.Float) { + isEnabled = property.value.floatValue > 0; + } + else if (property.value.propertyType == SerializedPropertyType.Enum) { + isEnabled = property.value.enumValueIndex > 0; + } + else if (property.value.propertyType == SerializedPropertyType.LayerMask) { + isEnabled = property.value.intValue != 0; + } + else if (property.value.propertyType == SerializedPropertyType.ObjectReference) { + isEnabled = property.value.objectReferenceValue != null; + } + } + + if (isEnabled) { + string warningMessage = null; + string fieldName = field.Name; + + // Check each stripped feature against the keywords in PlayerPrefs + if ((fieldName == "sharpenIntensity" && strippedKeywords.Contains(ShaderParams.SKW_SHARPEN)) || + (fieldName == "sharpenExclusionLayerMask" && strippedKeywords.Contains(ShaderParams.SKW_SHARPEN_EXCLUSION_MASK)) || + (fieldName == "ditherIntensity" && strippedKeywords.Contains(ShaderParams.SKW_DITHER)) || + (fieldName == "tonemap" && + ((property.value.enumValueIndex == (int)Beautify.TonemapOperator.ACES && strippedKeywords.Contains(ShaderParams.SKW_TONEMAP_ACES)) || + (property.value.enumValueIndex == (int)Beautify.TonemapOperator.ACESFitted && strippedKeywords.Contains(ShaderParams.SKW_TONEMAP_ACES_FITTED)) || + (property.value.enumValueIndex == (int)Beautify.TonemapOperator.AGX && strippedKeywords.Contains(ShaderParams.SKW_TONEMAP_AGX)))) || + (fieldName == "lut" && strippedKeywords.Contains(ShaderParams.SKW_LUT3D) && strippedKeywords.Contains(ShaderParams.SKW_LUT)) || + ((fieldName == "bloomIntensity" || fieldName == "anamorphicFlaresIntensity" || fieldName == "sunFlaresIntensity") && strippedKeywords.Contains(ShaderParams.SKW_BLOOM)) || + (fieldName == "outline" && strippedKeywords.Contains(ShaderParams.SKW_OUTLINE)) || + (fieldName == "nightVision" && strippedKeywords.Contains(ShaderParams.SKW_NIGHT_VISION)) || + (fieldName == "thermalVision" && strippedKeywords.Contains(ShaderParams.SKW_THERMAL_VISION)) || + (fieldName == "chromaticAberrationIntensity" && strippedKeywords.Contains(ShaderParams.SKW_CHROMATIC_ABERRATION)) || + (fieldName == "depthOfField" && strippedKeywords.Contains(ShaderParams.SKW_DEPTH_OF_FIELD)) || + (fieldName == "depthOfFieldTransparentSupport" && strippedKeywords.Contains(ShaderParams.SKW_DEPTH_OF_FIELD_TRANSPARENT)) || + (fieldName == "depthOfFieldAlphaTestSupport" && strippedKeywords.Contains(ShaderParams.SKW_DEPTH_OF_FIELD_TRANSPARENT)) || + (fieldName == "eyeAdaptation" && strippedKeywords.Contains(ShaderParams.SKW_EYE_ADAPTATION)) || + (fieldName == "purkinje" && strippedKeywords.Contains(ShaderParams.SKW_PURKINJE)) || + (fieldName == "vignettingOuterRing" && strippedKeywords.Contains(ShaderParams.SKW_VIGNETTING)) || + (fieldName == "vignettingMask" && strippedKeywords.Contains(ShaderParams.SKW_VIGNETTING_MASK)) || + (fieldName == "filmGrainIntensity" && strippedKeywords.Contains(ShaderParams.SKW_FILM_GRAIN)) || + (fieldName == "filmGrainEnabled" && strippedKeywords.Contains(ShaderParams.SKW_FILM_GRAIN)) || + (fieldName == "frame" && strippedKeywords.Contains(ShaderParams.SKW_FRAME)) || + (fieldName == "lensDirtIntensity" && strippedKeywords.Contains(ShaderParams.SKW_DIRT)) || + (fieldName == "antialiasStrength" && strippedKeywords.Contains(ShaderParams.SKW_EDGE_ANTIALIASING)) || + ((fieldName == "sepia" || fieldName == "daltonize" || fieldName == "colorTemp") && strippedKeywords.Contains(ShaderParams.SKW_COLOR_TWEAKS))) { + warningMessage = "This feature is stripped in the build."; + } + + if (warningMessage != null) { + var linkContent = new GUIContent("(click to configure)"); + var linkSize = EditorStyles.linkLabel.CalcSize(linkContent); + var height = EditorGUIUtility.singleLineHeight + 8; + + var warningRect = EditorGUILayout.GetControlRect(false, height); + warningRect.xMin += 8; + warningRect.xMax -= 8; + EditorGUI.HelpBox(warningRect, "", MessageType.Warning); + + var textRect = warningRect; + textRect.xMin += 24f; + textRect.xMax -= linkSize.x + 8; + EditorGUI.LabelField(textRect, warningMessage); + + var linkRect = warningRect; + linkRect.xMin = textRect.xMax; + linkRect.y = textRect.y + 3; + + if (GUI.Button(linkRect, linkContent, EditorStyles.linkLabel)) { + SelectActiveURPRendererAsset(); + } + } + } + } + + } + + void SetStyles () { + + // section header style + Color titleColor = EditorGUIUtility.isProSkin ? new Color(0.52f, 0.66f, 0.9f) : new Color(0.12f, 0.16f, 0.4f); + GUIStyle skurikenModuleTitleStyle = "ShurikenModuleTitle"; + sectionGroupStyle = new GUIStyle(skurikenModuleTitleStyle); + sectionGroupStyle.contentOffset = new Vector2(5f, -2f); + sectionGroupStyle.normal.textColor = titleColor; + sectionGroupStyle.fixedHeight = 22; + sectionGroupStyle.fontStyle = FontStyle.Bold; + + // foldout style + Color foldoutColor = EditorGUIUtility.isProSkin ? new Color(0.52f, 0.66f, 0.9f) : new Color(0.12f, 0.16f, 0.4f); + foldoutStyle = new GUIStyle(EditorStyles.foldout); + foldoutStyle.margin = new RectOffset(6, 0, 0, 0); + + } + + [VolumeParameterDrawer(typeof(Beautify.MinMaxFloatParameter))] + public class MinMaxFloatParameterDrawer : VolumeParameterDrawer { + public override bool OnGUI (SerializedDataParameter parameter, GUIContent title) { + if (parameter.value.propertyType == SerializedPropertyType.Vector2) { + var o = parameter.GetObjectRef(); + var range = o.value; + float x = range.x; + float y = range.y; + + EditorGUI.BeginChangeCheck(); + EditorGUILayout.MinMaxSlider(title, ref x, ref y, o.min, o.max); + x = EditorGUILayout.FloatField(x, GUILayout.Width(40)); + y = EditorGUILayout.FloatField(y, GUILayout.Width(40)); + if (EditorGUI.EndChangeCheck()) { + range.x = x; + range.y = y; + o.SetValue(new Beautify.MinMaxFloatParameter(range, o.min, o.max)); + } + return true; + } + else { + EditorGUILayout.PropertyField(parameter.value); + return false; + } + } + } + + Texture2D MakeTex (int width, int height, Color col) { + Color[] pix = new Color[width * height]; + + for (int i = 0; i < pix.Length; i++) + pix[i] = col; + + TextureFormat tf = SystemInfo.SupportsTextureFormat(TextureFormat.RGBAFloat) ? TextureFormat.RGBAFloat : TextureFormat.RGBA32; + Texture2D result = new Texture2D(width, height, tf, false); + result.hideFlags = HideFlags.DontSave; + result.SetPixels(pix); + result.Apply(); + + return result; + } + + void SelectActiveURPRendererAsset () { + var urpAsset = UniversalRenderPipeline.asset; + if (urpAsset != null && urpAsset.scriptableRenderer is UniversalRenderer urpRenderer) { + var rendererDataField = typeof(UniversalRenderPipelineAsset).GetField("m_RendererDataList", BindingFlags.NonPublic | BindingFlags.Instance); + var rendererDataList = rendererDataField?.GetValue(urpAsset) as ScriptableRendererData[]; + if (rendererDataList?.Length > 0) { + Selection.activeObject = rendererDataList[0]; + } + } + } + + } +} diff --git a/Assets/External/Beautify/URP/Editor/BeautifyEditor.cs.meta b/Assets/External/Beautify/URP/Editor/BeautifyEditor.cs.meta new file mode 100644 index 00000000..60aaa265 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/BeautifyEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f254be33cd84f4341a7ea1deab7213b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/BeautifyOptCompiler.cs b/Assets/External/Beautify/URP/Editor/BeautifyOptCompiler.cs new file mode 100644 index 00000000..bd08fe9d --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/BeautifyOptCompiler.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using UnityEditor.Build; +using UnityEditor.Rendering; +using UnityEngine; +using UnityEngine.Rendering; + +namespace Beautify.Universal { + + class BeautifyOptCompiler : IPreprocessShaders { + + public const string PLAYER_PREF_KEYNAME = "BeautifyStripKeywordSet"; + + public int callbackOrder => 1; + + public void OnProcessShader( + Shader shader, ShaderSnippetData snippet, IList shaderCompilerData) { + + try { + if (shaderCompilerData == null) return; + + if (!"Hidden/Universal Render Pipeline/UberPost".Equals(shader.name) && !"Hidden/Kronnect/Beautify".Equals(shader.name)) return; + + string strippedKeywords = PlayerPrefs.GetString(PLAYER_PREF_KEYNAME); + if (string.IsNullOrEmpty(strippedKeywords)) return; + + for (int k = shaderCompilerData.Count - 1; k >= 0; k--) { + ShaderCompilerData data = shaderCompilerData[k]; + ShaderKeyword[] keywords = data.shaderKeywordSet.GetShaderKeywords(); + for (int s = 0; s < keywords.Length; s++) { + ShaderKeyword keyword = keywords[s]; +#if UNITY_2021_2_OR_NEWER + string keywordName = keyword.name; +#else + string keywordName; + if (ShaderKeyword.IsKeywordLocal(keyword)) { + keywordName = ShaderKeyword.GetKeywordName(shader, keyword); + } else { + keywordName = ShaderKeyword.GetGlobalKeywordName(keyword); + } +#endif + if (keywordName.Length > 0 && strippedKeywords.Contains(keywordName)) { + shaderCompilerData.RemoveAt(k); + break; + } + } + } + } catch { } + + } + + } +} \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Editor/BeautifyOptCompiler.cs.meta b/Assets/External/Beautify/URP/Editor/BeautifyOptCompiler.cs.meta new file mode 100644 index 00000000..b8537d5f --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/BeautifyOptCompiler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e44552cb4a254ddd9e75bd9d95f0a0a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/BeautifyRenderFeatureEditor.cs b/Assets/External/Beautify/URP/Editor/BeautifyRenderFeatureEditor.cs new file mode 100644 index 00000000..0ecd3644 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/BeautifyRenderFeatureEditor.cs @@ -0,0 +1,295 @@ +using UnityEngine; +using UnityEditor; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +namespace Beautify.Universal { + + [CustomEditor(typeof(BeautifyRendererFeature))] + public class BeautifyRenderFeatureEditor : Editor { + + SerializedProperty renderPassEvent, ignorePostProcessingOption; +#if ENABLE_VR && ENABLE_XR_MODULE + SerializedProperty clearXRColorBuffer; +#endif + SerializedProperty cameraLayerMask; + SerializedProperty stripBeautifyTonemappingACES, stripBeautifyTonemappingACESFitted, stripBeautifyTonemappingAGX; + SerializedProperty stripBeautifySharpen, stripBeautifySharpenExclusionMask; + SerializedProperty stripBeautifyDithering, stripBeautifyEdgeAA; + SerializedProperty stripBeautifyLUT, stripBeautifyLUT3D, stripBeautifyColorTweaks; + SerializedProperty stripBeautifyBloom, stripBeautifyLensDirt, stripBeautifyChromaticAberration; + SerializedProperty stripBeautifyDoF, stripBeautifyDoFTransparentSupport; + SerializedProperty stripBeautifyEyeAdaptation, stripBeautifyPurkinje; + SerializedProperty stripBeautifyVignetting, stripBeautifyVignettingMask; + SerializedProperty stripBeautifyOutline; + SerializedProperty stripBeautifyNightVision, stripBeautifyThermalVision; + SerializedProperty stripBeautifyFrame; + SerializedProperty stripBeautifyFilmGrain; + SerializedProperty stripUnityFilmGrain, stripUnityDithering, stripUnityTonemapping; + SerializedProperty stripUnityBloom, stripUnityChromaticAberration; + SerializedProperty stripUnityDistortion, stripUnityDebugVariants; + + void OnEnable () { + renderPassEvent = serializedObject.FindProperty("renderPassEvent"); + ignorePostProcessingOption = serializedObject.FindProperty("ignorePostProcessingOption"); +#if ENABLE_VR && ENABLE_XR_MODULE + clearXRColorBuffer = serializedObject.FindProperty("clearXRColorBuffer"); +#endif + cameraLayerMask = serializedObject.FindProperty("cameraLayerMask"); + stripBeautifyTonemappingACES = serializedObject.FindProperty("stripBeautifyTonemappingACES"); + stripBeautifyTonemappingACESFitted = serializedObject.FindProperty("stripBeautifyTonemappingACESFitted"); + stripBeautifyTonemappingAGX = serializedObject.FindProperty("stripBeautifyTonemappingAGX"); + stripBeautifySharpen = serializedObject.FindProperty("stripBeautifySharpen"); + stripBeautifySharpenExclusionMask = serializedObject.FindProperty("stripBeautifySharpenExclusionMask"); + stripBeautifyDithering = serializedObject.FindProperty("stripBeautifyDithering"); + stripBeautifyEdgeAA = serializedObject.FindProperty("stripBeautifyEdgeAA"); + stripBeautifyLUT = serializedObject.FindProperty("stripBeautifyLUT"); + stripBeautifyLUT3D = serializedObject.FindProperty("stripBeautifyLUT3D"); + stripBeautifyColorTweaks = serializedObject.FindProperty("stripBeautifyColorTweaks"); + stripBeautifyBloom = serializedObject.FindProperty("stripBeautifyBloom"); + stripBeautifyLensDirt = serializedObject.FindProperty("stripBeautifyLensDirt"); + stripBeautifyChromaticAberration = serializedObject.FindProperty("stripBeautifyChromaticAberration"); + stripBeautifyDoF = serializedObject.FindProperty("stripBeautifyDoF"); + stripBeautifyDoFTransparentSupport = serializedObject.FindProperty("stripBeautifyDoFTransparentSupport"); + stripBeautifyEyeAdaptation = serializedObject.FindProperty("stripBeautifyEyeAdaptation"); + stripBeautifyPurkinje = serializedObject.FindProperty("stripBeautifyPurkinje"); + stripBeautifyVignetting = serializedObject.FindProperty("stripBeautifyVignetting"); + stripBeautifyVignettingMask = serializedObject.FindProperty("stripBeautifyVignettingMask"); + stripBeautifyOutline = serializedObject.FindProperty("stripBeautifyOutline"); + stripBeautifyNightVision = serializedObject.FindProperty("stripBeautifyNightVision"); + stripBeautifyThermalVision = serializedObject.FindProperty("stripBeautifyThermalVision"); + stripBeautifyFrame = serializedObject.FindProperty("stripBeautifyFrame"); + stripBeautifyFilmGrain = serializedObject.FindProperty("stripBeautifyFilmGrain"); + stripUnityFilmGrain = serializedObject.FindProperty("stripUnityFilmGrain"); + stripUnityDithering = serializedObject.FindProperty("stripUnityDithering"); + stripUnityTonemapping = serializedObject.FindProperty("stripUnityTonemapping"); + stripUnityBloom = serializedObject.FindProperty("stripUnityBloom"); + stripUnityChromaticAberration = serializedObject.FindProperty("stripUnityChromaticAberration"); + stripUnityDistortion = serializedObject.FindProperty("stripUnityDistortion"); + stripUnityDebugVariants = serializedObject.FindProperty("stripUnityDebugVariants"); + } + + public override void OnInspectorGUI () { + + serializedObject.Update(); + + EditorGUILayout.PropertyField(renderPassEvent); + EditorGUILayout.PropertyField(ignorePostProcessingOption); +#if ENABLE_VR && ENABLE_XR_MODULE + EditorGUILayout.PropertyField(clearXRColorBuffer); +#endif + EditorGUILayout.PropertyField(cameraLayerMask); + + GUIStyle boxStyle = new GUIStyle("box"); + boxStyle.padding = new RectOffset(10, 10, 10, 10); + boxStyle.margin = new RectOffset(10, 10, 10, 10); + + EditorGUILayout.BeginVertical(boxStyle); + EditorGUILayout.LabelField("Beautify Shader Features Stripping", EditorStyles.boldLabel); + EditorGUILayout.HelpBox("Optimize shader compilation time by stripping unused Beautify features. Select the features you wish to exclude from the build.", MessageType.Info); + + void DrawStripToggle (SerializedProperty property, string label) { + EditorGUILayout.BeginHorizontal(); + property.boolValue = GUILayout.Toggle(property.boolValue, "", GUILayout.Width(20)); + GUILayout.Label(label); + EditorGUILayout.EndHorizontal(); + } + + if (GUILayout.Button("Autoselect Unused Beautify Features", EditorStyles.miniButton)) { + if (EditorUtility.DisplayDialog("Autoselect Unused Beautify Features", "This will disable features not used in the current scene. Do you want to proceed?", "Yes", "No")) { + +#if UNITY_2023_1_OR_NEWER + var beautifyVolumes = FindObjectsByType(FindObjectsSortMode.None); +#else + var beautifyVolumes = FindObjectsOfType(); +#endif + + bool isFeatureUsed (System.Func predicate) { + foreach (var volume in beautifyVolumes) { + if (predicate(volume)) { + return true; + } + } + return false; + } + + stripBeautifySharpen.boolValue = !isFeatureUsed(b => b.sharpenIntensity.value > 0f); + stripBeautifySharpenExclusionMask.boolValue = !isFeatureUsed(b => b.sharpenIntensity.value > 0f && b.sharpenExclusionLayerMask.value != 0); + stripBeautifyDithering.boolValue = !isFeatureUsed(b => b.ditherIntensity.value > 0f); + stripBeautifyEdgeAA.boolValue = !isFeatureUsed(b => b.antialiasStrength.value > 0f); + stripBeautifyTonemappingACES.boolValue = !isFeatureUsed(b => b.tonemap.value == Beautify.TonemapOperator.ACES); + stripBeautifyTonemappingACESFitted.boolValue = !isFeatureUsed(b => b.tonemap.value == Beautify.TonemapOperator.ACESFitted); + stripBeautifyTonemappingAGX.boolValue = !isFeatureUsed(b => b.tonemap.value == Beautify.TonemapOperator.AGX); + stripBeautifyLUT.boolValue = !isFeatureUsed(b => b.lut.value && b.lutIntensity.value > 0 && b.lutTexture.value != null && !(b.lutTexture.value is Texture3D)); + stripBeautifyLUT3D.boolValue = !isFeatureUsed(b => b.lut.value && b.lutIntensity.value > 0 && b.lutTexture.value is Texture3D); + stripBeautifyColorTweaks.boolValue = !isFeatureUsed(b => b.sepia.value > 0 || b.daltonize.value > 0 || b.colorTempBlend.value > 0); + stripBeautifyBloom.boolValue = !isFeatureUsed(b => b.bloomIntensity.value > 0f); + stripBeautifyLensDirt.boolValue = !isFeatureUsed(b => b.lensDirtIntensity.value > 0); + stripBeautifyChromaticAberration.boolValue = !isFeatureUsed(b => b.chromaticAberrationIntensity.value > 0f); + stripBeautifyDoF.boolValue = !isFeatureUsed(b => b.depthOfField.value); + stripBeautifyDoFTransparentSupport.boolValue = !isFeatureUsed(b => b.depthOfFieldTransparentSupport.value); + stripBeautifyEyeAdaptation.boolValue = !isFeatureUsed(b => b.eyeAdaptation.value); + stripBeautifyPurkinje.boolValue = !isFeatureUsed(b => b.purkinje.value); + stripBeautifyVignetting.boolValue = !isFeatureUsed(b => b.vignettingOuterRing.value > 0f); + stripBeautifyVignettingMask.boolValue = !isFeatureUsed(b => b.vignettingOuterRing.value > 0f && b.vignettingMask.value != null); + stripBeautifyOutline.boolValue = !isFeatureUsed(b => b.outline.value); + stripBeautifyNightVision.boolValue = !isFeatureUsed(b => b.nightVision.value); + stripBeautifyThermalVision.boolValue = !isFeatureUsed(b => b.thermalVision.value); + stripBeautifyFrame.boolValue = !isFeatureUsed(b => b.frame.value); + stripBeautifyFilmGrain.boolValue = !isFeatureUsed(b => b.filmGrainEnabled.value && (b.filmGrainIntensity.value > 0f || b.filmGrainDirtSpotsAmount.value > 0f || b.filmGrainScratchesAmount.value > 0f)); + } + } + + // Image Enhancement section + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Image Enhancement", EditorStyles.boldLabel); + if (GUILayout.Button("Toggle All", EditorStyles.miniButton, GUILayout.Width(80))) { + bool allStripped = stripBeautifySharpen.boolValue && + stripBeautifySharpenExclusionMask.boolValue && + stripBeautifyDithering.boolValue && + stripBeautifyEdgeAA.boolValue; + stripBeautifySharpen.boolValue = !allStripped; + stripBeautifySharpenExclusionMask.boolValue = !allStripped; + stripBeautifyDithering.boolValue = !allStripped; + stripBeautifyEdgeAA.boolValue = !allStripped; + } + EditorGUILayout.EndHorizontal(); + DrawStripToggle(stripBeautifySharpen, "Strip Sharpen"); + DrawStripToggle(stripBeautifySharpenExclusionMask, "Strip Sharpen Exclusion Mask"); + DrawStripToggle(stripBeautifyDithering, "Strip Dithering"); + DrawStripToggle(stripBeautifyEdgeAA, "Strip Edge AA"); + + // Tonemapping section + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Tonemapping", EditorStyles.boldLabel); + if (GUILayout.Button("Toggle All", EditorStyles.miniButton, GUILayout.Width(80))) { + bool allStripped = stripBeautifyTonemappingACES.boolValue && + stripBeautifyTonemappingACESFitted.boolValue && + stripBeautifyTonemappingAGX.boolValue; + stripBeautifyTonemappingACES.boolValue = !allStripped; + stripBeautifyTonemappingACESFitted.boolValue = !allStripped; + stripBeautifyTonemappingAGX.boolValue = !allStripped; + } + EditorGUILayout.EndHorizontal(); + DrawStripToggle(stripBeautifyTonemappingACES, "Strip ACES Tonemapping"); + DrawStripToggle(stripBeautifyTonemappingACESFitted, "Strip ACES Fitted Tonemapping"); + DrawStripToggle(stripBeautifyTonemappingAGX, "Strip AGX Tonemapping"); + + // Color Grading section + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Color Grading", EditorStyles.boldLabel); + if (GUILayout.Button("Toggle All", EditorStyles.miniButton, GUILayout.Width(80))) { + bool allStripped = stripBeautifyLUT.boolValue && + stripBeautifyLUT3D.boolValue && + stripBeautifyColorTweaks.boolValue; + stripBeautifyLUT.boolValue = !allStripped; + stripBeautifyLUT3D.boolValue = !allStripped; + stripBeautifyColorTweaks.boolValue = !allStripped; + } + EditorGUILayout.EndHorizontal(); + DrawStripToggle(stripBeautifyLUT, "Strip LUT"); + DrawStripToggle(stripBeautifyLUT3D, "Strip LUT 3D"); + DrawStripToggle(stripBeautifyColorTweaks, new GUIContent("Strip Color Tweaks", "Refers to sepia, daltonize and color temperature").text); + + // Effects section + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Effects", EditorStyles.boldLabel); + if (GUILayout.Button("Toggle All", EditorStyles.miniButton, GUILayout.Width(80))) { + bool allStripped = stripBeautifyBloom.boolValue && + stripBeautifyLensDirt.boolValue && + stripBeautifyChromaticAberration.boolValue && + stripBeautifyDoF.boolValue && + stripBeautifyDoFTransparentSupport.boolValue && + stripBeautifyEyeAdaptation.boolValue && + stripBeautifyPurkinje.boolValue && + stripBeautifyVignetting.boolValue && + stripBeautifyVignettingMask.boolValue && + stripBeautifyOutline.boolValue && + stripBeautifyNightVision.boolValue && + stripBeautifyThermalVision.boolValue && + stripBeautifyFrame.boolValue && + stripBeautifyFilmGrain.boolValue; + stripBeautifyBloom.boolValue = !allStripped; + stripBeautifyLensDirt.boolValue = !allStripped; + stripBeautifyChromaticAberration.boolValue = !allStripped; + stripBeautifyDoF.boolValue = !allStripped; + stripBeautifyDoFTransparentSupport.boolValue = !allStripped; + stripBeautifyEyeAdaptation.boolValue = !allStripped; + stripBeautifyPurkinje.boolValue = !allStripped; + stripBeautifyVignetting.boolValue = !allStripped; + stripBeautifyVignettingMask.boolValue = !allStripped; + stripBeautifyOutline.boolValue = !allStripped; + stripBeautifyNightVision.boolValue = !allStripped; + stripBeautifyThermalVision.boolValue = !allStripped; + stripBeautifyFrame.boolValue = !allStripped; + stripBeautifyFilmGrain.boolValue = !allStripped; + } + EditorGUILayout.EndHorizontal(); + DrawStripToggle(stripBeautifyBloom, "Strip Bloom, Anamorphic & Sun Flares"); + DrawStripToggle(stripBeautifyLensDirt, "Strip Lens Dirt"); + DrawStripToggle(stripBeautifyChromaticAberration, "Strip Chromatic Aberration"); + DrawStripToggle(stripBeautifyDoF, "Strip Depth of Field"); + DrawStripToggle(stripBeautifyDoFTransparentSupport, "Strip DoF Transparent Support"); + DrawStripToggle(stripBeautifyEyeAdaptation, "Strip Eye Adaptation"); + DrawStripToggle(stripBeautifyPurkinje, "Strip Purkinje"); + DrawStripToggle(stripBeautifyVignetting, "Strip Vignetting"); + DrawStripToggle(stripBeautifyVignettingMask, "Strip Vignetting Mask"); + DrawStripToggle(stripBeautifyOutline, "Strip Outline"); + DrawStripToggle(stripBeautifyNightVision, "Strip Night Vision"); + DrawStripToggle(stripBeautifyThermalVision, "Strip Thermal Vision"); + DrawStripToggle(stripBeautifyFrame, "Strip Frame"); + DrawStripToggle(stripBeautifyFilmGrain, "Strip Film Grain"); + + EditorGUILayout.Separator(); + // Unity Post Processing section + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Unity Post Processing Stripping", EditorStyles.boldLabel); + if (GUILayout.Button("Toggle All", EditorStyles.miniButton, GUILayout.Width(80))) { + bool allStripped = stripUnityFilmGrain.boolValue && + stripUnityDithering.boolValue && + stripUnityTonemapping.boolValue && + stripUnityBloom.boolValue && + stripUnityChromaticAberration.boolValue && + stripUnityDistortion.boolValue && + stripUnityDebugVariants.boolValue; + stripUnityFilmGrain.boolValue = !allStripped; + stripUnityDithering.boolValue = !allStripped; + stripUnityTonemapping.boolValue = !allStripped; + stripUnityBloom.boolValue = !allStripped; + stripUnityChromaticAberration.boolValue = !allStripped; + stripUnityDistortion.boolValue = !allStripped; + stripUnityDebugVariants.boolValue = !allStripped; + } + EditorGUILayout.EndHorizontal(); + DrawStripToggle(stripUnityFilmGrain, "Strip Film Grain"); + DrawStripToggle(stripUnityDithering, "Strip Dithering"); + DrawStripToggle(stripUnityTonemapping, "Strip Tonemapping"); + DrawStripToggle(stripUnityBloom, "Strip Bloom"); + DrawStripToggle(stripUnityChromaticAberration, "Strip Chromatic Aberration"); + DrawStripToggle(stripUnityDistortion, "Strip Distortion"); + DrawStripToggle(stripUnityDebugVariants, "Strip Debug Variants"); + EditorGUILayout.EndVertical(); + + if (GUILayout.Button("Select Beautify Volume >")) { +#if UNITY_2023_1_OR_NEWER + var volumes = FindObjectsByType(FindObjectsSortMode.None); +#else + var volumes = FindObjectsOfType(); +#endif + + foreach (var volume in volumes) { + if (volume.sharedProfile != null && volume.sharedProfile.TryGet(out var beautify)) { + Selection.activeObject = volume.gameObject; + EditorGUIUtility.PingObject(volume.gameObject); + break; + } + } + } + + if (serializedObject.ApplyModifiedProperties()) { + BeautifyRendererFeature feature = (BeautifyRendererFeature)target; + feature.SetStripShaderKeywords(); + } + } + } +} \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Editor/BeautifyRenderFeatureEditor.cs.meta b/Assets/External/Beautify/URP/Editor/BeautifyRenderFeatureEditor.cs.meta new file mode 100644 index 00000000..25f4f327 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/BeautifyRenderFeatureEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f7286e18c946445284b04f79b720134 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/ContactUs.cs b/Assets/External/Beautify/URP/Editor/ContactUs.cs new file mode 100644 index 00000000..35874385 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/ContactUs.cs @@ -0,0 +1,211 @@ +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace Beautify.Universal { + + public class ContactUsWindow : EditorWindow { + const string OnlineGuidesUrl = "https://kronnect.com/guides"; + const string SupportUrl = "https://kronnect.com/support"; + const string YoutubeUrl = "https://youtube.com/@kronnect"; + const string TwitterUrl = "https://twitter.com/kronnect"; + const string KronnectUrl = "https://assetstore.unity.com/publishers/15018?aid=1101lGsd"; + const string ReferralInfo = "?aid=1101lGsd&pubref=beautify"; + Texture2D kronnectLogo, welcomeBanner; + GUIStyle headerStyle, bannerStyle; + + readonly List assetCategories = new List + { + new AssetCategory + { + name = "Image Effects", + assets = new List + { + new Asset { name = "Beautify 3 - Advanced Post Processing", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/beautify-3-advanced-post-processing-233073" }, + new Asset { name = "Frame Pack for Beautify", url = "https://assetstore.unity.com/packages/2d/gui/frame-pack-204058" }, + new Asset { name = "LUT Pack for Beautify", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/lut-pack-for-beautify-202502" }, + new Asset { name = "Beautify HDRP", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/beautify-hdrp-165411" }, + new Asset { name = "Cloud Shadows FX", url = "https://assetstore.unity.com/packages/vfx/shaders/cloud-shadows-fx-267702" }, + new Asset { name = "Dynamic Fog & Mist 2", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/dynamic-fog-mist-2-48200" }, + new Asset { name = "Global Snow 2", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/global-snow-2-248191" }, + new Asset { name = "Luma Based Ambient Occlusion (SSAO 2D)", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/luma-based-ambient-occlusion-2-ssao-2d-249066" }, + new Asset { name = "Radiant Global Illumination", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/radiant-global-illumination-225934" }, + new Asset { name = "Shiny SSR 2", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/shiny-ssr-2-screen-space-reflections-188638" }, + new Asset { name = "Sun Flares HDRP", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/sun-flares-hdrp-171177" }, + new Asset { name = "Umbra Soft Shadows", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/umbra-soft-shadows-better-directional-contact-shadows-for-urp-282485" }, + new Asset { name = "Volumetric Fog & Mist 2", url = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/volumetric-fog-mist-2-162694" }, + new Asset { name = "Volumetric Lights 2", url = "https://assetstore.unity.com/packages/vfx/shaders/volumetric-lights-2-234539" }, + new Asset { name = "Volumetric Lights Set", url = "https://assetstore.unity.com/packages/3d/props/volumetric-lights-set-237873" }, + new Asset { name = "Volumetric Lights 2 HDRP", url = "https://assetstore.unity.com/packages/vfx/shaders/volumetric-lights-2-hdrp-243807" }, + } + }, + new AssetCategory + { + name = "Tools & Shaders", + assets = new List + { + new Asset { name = "Compass Navigator Pro 2", url = "https://assetstore.unity.com/packages/tools/gui/compass-navigator-pro-2-273662" }, + new Asset { name = "Highlight Plus", url = "https://assetstore.unity.com/packages/vfx/shaders/highlight-plus-all-in-one-outline-selection-effects-134149" }, + new Asset { name = "Highlight Plus 2D", url = "https://assetstore.unity.com/packages/vfx/shaders/highlight-plus-2d-138383" }, + new Asset { name = "Liquid Volume 2", url = "https://assetstore.unity.com/packages/vfx/shaders/liquid-volume-2-249127" }, + new Asset { name = "Liquid Volume Pro 2", url = "https://assetstore.unity.com/packages/vfx/shaders/liquid-volume-pro-2-129967" }, + new Asset { name = "Liquid Volume Pro 2 HDRP", url = "https://assetstore.unity.com/packages/vfx/shaders/liquid-volume-pro-2-hdrp-253786" }, + new Asset { name = "Potions & Volumetric Liquid", url = "https://assetstore.unity.com/packages/slug/123474" }, + new Asset { name = "Shader Control", url = "https://assetstore.unity.com/packages/vfx/shaders/shader-control-74817" }, + new Asset { name = "Split Screen Pro", url = "https://assetstore.unity.com/packages/tools/camera/split-screen-pro-207149" }, + new Asset { name = "Skybox Plus", url = "https://assetstore.unity.com/packages/2d/environments/skybox-plus-182966" }, + new Asset { name = "Trails FX", url = "https://assetstore.unity.com/packages/vfx/shaders/trails-fx-146898" }, + new Asset { name = "Transitions Plus", url = "https://assetstore.unity.com/packages/tools/camera/transitions-plus-266067" }, + new Asset { name = "Tunnel FX 2", url = "https://assetstore.unity.com/packages/vfx/shaders/tunnel-fx-2-86544" }, + new Asset { name = "Voxel Play 2", url = "https://assetstore.unity.com/packages/tools/game-toolkits/voxel-play-2-201234" }, + new Asset { name = "Pirates of Voxel Play", url = "https://assetstore.unity.com/packages/tools/game-toolkits/pirates-of-voxel-play-189096" }, + new Asset { name = "X-Frame FPS Accelerator", url = "https://assetstore.unity.com/packages/tools/camera/x-frame-fps-accelerator-63965" } + } + }, + new AssetCategory + { + name = "Grids & Maps", + assets = new List + { + new Asset { name = "Grids 2D", url = "https://assetstore.unity.com/packages/tools/game-toolkits/grids-2d-59981" }, + new Asset { name = "Hexasphere Grid System", url = "https://assetstore.unity.com/packages/tools/modeling/hexasphere-grid-system-89112" }, + new Asset { name = "Terrain Grid System 2", url = "https://assetstore.unity.com/packages/tools/terrain/terrain-grid-system-2-244921" }, + new Asset { name = "World Map 2D Edition 2", url = "https://assetstore.unity.com/packages/tools/gui/world-map-2d-edition-2-151238" }, + new Asset { name = "World Map Globe Edition 2", url = "https://assetstore.unity.com/packages/tools/gui/world-map-globe-edition-2-150643" }, + new Asset { name = "World Map Strategy Kit 2", url = "https://assetstore.unity.com/packages/tools/game-toolkits/world-map-strategy-kit-2-150938" }, + new Asset { name = "World Maps & Weather Symbols", url = "https://assetstore.unity.com/packages/2d/textures-materials/world-flags-and-weather-symbols-69010" }, + new Asset { name = "Military Units 2D", url = "https://assetstore.unity.com/packages/2d/textures-materials/military-units-the-stylized-art-collection-187769" }, + new Asset { name = "Military Units 3D", url = "https://assetstore.unity.com/packages/3d/vehicles/military-units-3d-246876" }, + } + } +}; + + + void OnEnable () { + kronnectLogo = Resources.Load("kronnectLogo"); + welcomeBanner = Resources.Load("welcomeBanner"); + } + + void DrawHeader (string title) { + if (headerStyle == null) { + GUIStyle skurikenModuleTitleStyle = "ShurikenModuleTitle"; + headerStyle = new GUIStyle(skurikenModuleTitleStyle) { + contentOffset = new Vector2(5f, -2f), + normal = { textColor = Color.white }, + fixedHeight = 24, + fontSize = 13 + }; + } + + GUILayout.Label(title, headerStyle); + } + + void OnGUI () { + GUILayout.BeginHorizontal(); + GUILayout.Space(10); + GUILayout.BeginVertical(); + GUILayout.Space(10); + + DrawHeader("Online Resources"); + + GUILayout.BeginHorizontal(); + GUILayout.Space(10); + GUILayout.BeginVertical(); + + if (GUILayout.Button("Asset Documentation", EditorStyles.linkLabel)) { + Application.OpenURL(OnlineGuidesUrl); + } + if (GUILayout.Button("Support & Community", EditorStyles.linkLabel)) { + Application.OpenURL(SupportUrl); + } + if (GUILayout.Button("YouTube Channel", EditorStyles.linkLabel)) { + Application.OpenURL(YoutubeUrl); + } + if (GUILayout.Button("X / Twitter", EditorStyles.linkLabel)) { + Application.OpenURL(TwitterUrl); + } + if (GUILayout.Button("Kronnect Asset Store", EditorStyles.linkLabel)) { + Application.OpenURL(KronnectUrl); + } + GUILayout.EndVertical(); + GUILayout.FlexibleSpace(); + GUILayout.BeginHorizontal(); + + if (bannerStyle == null) { + bannerStyle = new GUIStyle(GUI.skin.button); + bannerStyle.normal.background = welcomeBanner; + bannerStyle.normal.scaledBackgrounds = new[] { welcomeBanner }; + } + const float width = 1100 / 2; + const float height = 200 / 2; + + if (GUILayout.Button("", bannerStyle, GUILayout.Width(width), GUILayout.Height(height))) { + Application.OpenURL(KronnectUrl); + } + GUILayout.EndHorizontal(); + + GUILayout.EndHorizontal(); + + GUILayout.Space(20); + + DrawHeader("Kronnect Assets"); + + GUIStyle textStyle = new GUIStyle(EditorStyles.wordWrappedLabel) { + fontSize = 11 + }; + GUILayout.Label("Thank you for using this asset!\nWe invite you to explore more assets and complete your collection by visiting the affiliated links below to the Asset Store:", textStyle); + + EditorGUILayout.Space(10); + GUILayout.BeginHorizontal(); + + foreach (var category in assetCategories) { + GUILayout.BeginVertical(); + GUILayout.Label(category.name, EditorStyles.boldLabel); + foreach (var asset in category.assets) { + GUILayout.BeginHorizontal(); + GUILayout.Space(10); + if (GUILayout.Button(asset.name, EditorStyles.linkLabel)) { + Application.OpenURL(asset.url + ReferralInfo); + } + GUILayout.EndHorizontal(); + } + GUILayout.EndVertical(); + } + + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Close", GUILayout.Width(60))) { + Close(); + } + EditorGUILayout.Space(); + GUILayout.Label(new GUIContent(kronnectLogo), GUILayout.Width(100), GUILayout.Height(30)); + EditorGUILayout.EndHorizontal(); + + GUILayout.Space(10); + GUILayout.EndVertical(); + GUILayout.Space(10); + GUILayout.EndHorizontal(); + } + + public static void ShowScreen () { + ContactUsWindow window = GetWindow(true, "Online Resources", true); + window.minSize = window.maxSize = new Vector2(750, 640); + } + + [System.Serializable] + public class AssetCategory { + public string name; + public List assets; + } + + [System.Serializable] + public class Asset { + public string name; + public string url; + } + } + +} \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Editor/ContactUs.cs.meta b/Assets/External/Beautify/URP/Editor/ContactUs.cs.meta new file mode 100644 index 00000000..b3e2efb5 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/ContactUs.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1afc11f03842d43bfa05390519730021 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/CubeLUTImporter.cs b/Assets/External/Beautify/URP/Editor/CubeLUTImporter.cs new file mode 100644 index 00000000..f5b37506 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/CubeLUTImporter.cs @@ -0,0 +1,191 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using System.IO; +using System.Globalization; +using System.Text; + +namespace Beautify.Universal { + + public class CubeLUTImporter : EditorWindow { + + [MenuItem("Window/Beautify/Import CUBE LUT")] + public static void ShowBrowser() { + string path = EditorUtility.OpenFilePanel("Select .CUBE file", "", "cube"); + if (string.IsNullOrEmpty(path)) return; + Texture tex = Import(path); + if (tex != null) { + Beautify b = BeautifySettings.sharedSettings; + b.lutIntensity.Override(1); + b.lutTexture.Override(tex); + b.lut.Override(true); + } + } + + public static Texture3D Import(string path) { + + // Check if path is within assets folder + string assetPath = path; + int k = path.IndexOf("Assets/"); + if (k >= 0) { + assetPath = assetPath.Substring(k); + } else { + assetPath = "Assets/Imported CUBE LUTs/" + Path.GetFileName(assetPath); + } + + assetPath = Path.Combine(Path.GetDirectoryName(assetPath), Path.GetFileNameWithoutExtension(assetPath)); + if (!assetPath.ToUpper().EndsWith("_LUT")) { + assetPath += "_LUT"; + } + assetPath += ".asset"; + var tex = AssetDatabase.LoadAssetAtPath(assetPath); + + if (tex != null) return tex; // safe behaviour: if file exists, do not change anything + + // Read the lut data + string[] lines = File.ReadAllLines(path); + + // Start parsing + int i = 0; + int size = -1; + int sizeCube = -1; + var table = new List(); + var domainMin = Color.black; + var domainMax = Color.white; + + while (true) { + if (i >= lines.Length) { + if (table.Count != sizeCube) + Debug.LogError("Premature end of file"); + + break; + } + + string line = FilterLine(lines[i]); + + if (string.IsNullOrEmpty(line)) + goto next; + + // Header data + if (line.StartsWith("TITLE")) + goto next; // Skip the title tag, we don't need it + + if (line.StartsWith("LUT_3D_SIZE")) { + string sizeStr = line.Substring(11).TrimStart(); + + if (!int.TryParse(sizeStr, out size)) { + Debug.LogError("Invalid data on line " + i); + break; + } + + if (size < 2 || size > 256) { + Debug.LogError("LUT size out of range"); + break; + } + + sizeCube = size * size * size; + goto next; + } + + if (line.StartsWith("DOMAIN_MIN")) { + if (!ParseDomain(i, line, ref domainMin)) break; + goto next; + } + + if (line.StartsWith("DOMAIN_MAX")) { + if (!ParseDomain(i, line, ref domainMax)) break; + goto next; + } + + // Table + string[] row = line.Split(); + + if (row.Length != 3) { + Debug.LogError("Invalid data on line " + i); + break; + } + + var color = Color.black; + for (int j = 0; j < 3; j++) { + float d; + if (!float.TryParse(row[j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out d)) { + Debug.LogError("Invalid data on line " + i); + break; + } + + color[j] = d; + } + + table.Add(color); + + next: + i++; + } + + if (sizeCube != table.Count) { + Debug.LogError("Wrong table size - Expected " + sizeCube + " elements, got " + table.Count); + return null; + } + + // Generate a new Texture3D + tex = new Texture3D(size, size, size, TextureFormat.RGBAHalf, false) { + anisoLevel = 0, + filterMode = FilterMode.Bilinear, + wrapMode = TextureWrapMode.Clamp, + }; + + tex.SetPixels(table.ToArray(), 0); + tex.Apply(); + + // Save to disk + AssetDatabase.CreateAsset(tex, assetPath); + + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + + tex = AssetDatabase.LoadAssetAtPath(assetPath); + return tex; + } + + static string FilterLine(string line) { + var filtered = new StringBuilder(); + line = line.TrimStart().TrimEnd(); + int len = line.Length; + int i = 0; + + while (i < len) { + char c = line[i]; + + if (c == '#') // Filters comment out + break; + + filtered.Append(c); + i++; + } + + return filtered.ToString(); + } + + static bool ParseDomain(int i, string line, ref Color domain) { + string[] domainStrs = line.Substring(10).TrimStart().Split(); + + if (domainStrs.Length != 3) { + Debug.LogError("Invalid data on line " + i); + return false; + } + + for (int j = 0; j < 3; j++) { + float d; + if (!float.TryParse(domainStrs[j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out d)) { + Debug.LogError("Invalid data on line " + i); + return false; + } + + domain[j] = d; + } + + return true; + } + } + +} \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Editor/CubeLUTImporter.cs.meta b/Assets/External/Beautify/URP/Editor/CubeLUTImporter.cs.meta new file mode 100644 index 00000000..bb35fd13 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/CubeLUTImporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 880fcc03372614592baab50db0731b13 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/FrameBrowser.cs b/Assets/External/Beautify/URP/Editor/FrameBrowser.cs new file mode 100644 index 00000000..b8ac34ea --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/FrameBrowser.cs @@ -0,0 +1,231 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using System.IO; + +namespace Beautify.Universal { + + public class FrameBrowser : EditorWindow { + + const string MASTER_FOLDER_NAME = "Frame Pack"; + + Material referenceMaterial; + Vector2 scrollPos; + static int columnCount = 4; + + struct FrameEntry { + public Material mat; + public Texture2D frameMask; + } + + struct FrameGroup { + public string categoryPath; + public string categoryName; + public List frames; + public bool visible; + } + FrameGroup[] groups; + + + [MenuItem("Window/Beautify/Frame Browser")] + public static void ShowBrowser() { + GetWindow("Frame Browser"); + } + + static class ShaderParams { + public static int frameMaskTexture = Shader.PropertyToID("_FrameMask"); + public static int lutPreview = Shader.PropertyToID("_LUTPreview"); + } + + private void OnEnable() { + RefreshFrames(); + ClearBackground(); + } + + void ClearBackground() { + Shader.SetGlobalTexture(ShaderParams.lutPreview, Texture2D.whiteTexture); + } + + private void OnGUI() { + + if (groups == null) { + EditorGUILayout.HelpBox("Frame Pack not found.", MessageType.Info); + if (GUILayout.Button("View Frame Pack on the Unity Asset Store")) { + Application.OpenURL("https://assetstore.unity.com/packages/slug/204058"); + } + if (GUILayout.Button("Reload Frame Pack")) { + RefreshFrames(); + } + return; + } + + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Find Frames")) { + RefreshFrames(); + } + if (GUILayout.Button("Capture SceneView")) { + RequestCapture(CameraType.SceneView); + } + if (GUILayout.Button("Capture GameView")) { + RequestCapture(CameraType.Game); + } + if (GUILayout.Button("White Background")) { + ClearBackground(); + } + EditorGUILayout.EndHorizontal(); + + columnCount = EditorGUILayout.IntSlider("Columns:", columnCount, 1, 5); + + Texture2D wt = Texture2D.whiteTexture; + float rowHeight = 0.5f * EditorGUIUtility.currentViewWidth / columnCount; + + EditorGUILayout.HelpBox("Click on the name of a Frame to toggle it on/off.", MessageType.Info); + scrollPos = EditorGUILayout.BeginScrollView(scrollPos); + Beautify b = BeautifySettings.sharedSettings; + if (b == null) { + EditorGUILayout.HelpBox("Beautify not found in the scene.", MessageType.Warning); + } else { + for (int k = 0; k < groups.Length; k++) { + groups[k].visible = EditorGUILayout.Foldout(groups[k].visible, "Category: " + groups[k].categoryName); + if (groups[k].visible) { + int c = groups[k].frames.Count; + int matIndex = 0; + while (matIndex < c) { + EditorGUILayout.BeginVertical(); + Rect rect = EditorGUILayout.GetControlRect(); + float w = rect.width / columnCount; + rect.width = w - 5; + for (int col = 0; col < columnCount; col++) { + if (matIndex < c) { + FrameEntry frameEntry = groups[k].frames[matIndex]; + if (frameEntry.mat != null) { + rect.height = rowHeight; + frameEntry.mat.SetTexture(ShaderParams.frameMaskTexture, frameEntry.frameMask); + EditorGUI.DrawPreviewTexture(rect, wt, frameEntry.mat); + rect.y += rowHeight; + rect.height = 15; + string frameName; + if (b.frame.value && b.frame.overrideState && b.frameMask == frameEntry.frameMask) { + frameName = "✔ " + frameEntry.mat.name; + } else { + frameName = frameEntry.mat.name; + } + if (GUI.Button(rect, frameName)) { + if (b.frame.value && b.frame.overrideState && b.frameMask == frameEntry.frameMask) { + b.frame.Override(false); + } else { + b.frame.Override(true); + b.frameMask.Override(frameEntry.frameMask); + b.frameColor.Override(Color.white); + } + EditorUtility.SetDirty(b); + if (!Application.isPlaying) { + UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); + } + } + rect.y -= rowHeight; + rect.x += w; + } + matIndex++; + } + } + GUILayout.Space(rowHeight); + EditorGUILayout.EndVertical(); + EditorGUILayout.Separator(); + } + } + } + } + EditorGUILayout.EndScrollView(); + } + + private void OnDestroy() { + ReleaseGroups(); + } + + void ReleaseGroups() { + if (groups != null) { + foreach (FrameGroup g in groups) { + if (g.frames != null) { + foreach (FrameEntry l in g.frames) { + if (l.mat != null) { + DestroyImmediate(l.mat); + } + } + g.frames.Clear(); + } + } + } + groups = null; + } + + void RequestCapture(CameraType cameraType) { + + BeautifySettings b; +#if UNITY_2023_1_OR_NEWER + b = FindAnyObjectByType(); +#else + b = FindObjectOfType(); +#endif + + if (b == null) { + Debug.LogError("Beautify not found. It's requred for the LUT Browser functionality."); + return; + } + BeautifyRendererFeature.captureCameraType = cameraType; + BeautifyRendererFeature.requestScreenCapture = true; + EditorUtility.SetDirty(BeautifySettings.sharedSettings); + } + + + void RefreshFrames() { + + RequestCapture(BeautifyRendererFeature.captureCameraType); + ReleaseGroups(); + if (referenceMaterial == null) { + referenceMaterial = new Material(Shader.Find("Hidden/Beautify/FrameThumbnail")); + } + string[] res = Directory.GetDirectories(Application.dataPath, "*" + MASTER_FOLDER_NAME + "*", SearchOption.AllDirectories); + string path = null; + for (int k = 0; k < res.Length; k++) { + if (res[k].Contains("Frame Pack")) { + path = res[k]; + break; + } + } + if (path == null) { + return; + } + string[] categories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); + groups = new FrameGroup[categories.Length]; + for (int c = 0; c < categories.Length; c++) { + FrameGroup group = new FrameGroup(); + group.categoryPath = categories[c]; + group.categoryName = Path.GetFileName(group.categoryPath); + group.frames = new List(); + string[] frames = Directory.GetFiles(group.categoryPath, "*.png", SearchOption.AllDirectories); + if (frames != null) { + for (int l = 0; l < frames.Length; l++) { + string framePath = frames[l]; + int i = framePath.IndexOf("/Assets"); + if (i < 0) continue; + framePath = framePath.Substring(i + 1); + Texture2D frameMask = AssetDatabase.LoadAssetAtPath(framePath) as Texture2D; + if (frameMask != null) { + Material mat = Instantiate(referenceMaterial); + mat.name = Path.GetFileNameWithoutExtension(framePath); + FrameEntry entry = new FrameEntry(); + entry.mat = mat; + entry.frameMask = frameMask; + group.frames.Add(entry); + } + } + } + groups[c] = group; + } + + } + + } + +} \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Editor/FrameBrowser.cs.meta b/Assets/External/Beautify/URP/Editor/FrameBrowser.cs.meta new file mode 100644 index 00000000..10473e00 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/FrameBrowser.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b48e93dd24694f528b5e755ab766cad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/LUTBrowser.cs b/Assets/External/Beautify/URP/Editor/LUTBrowser.cs new file mode 100644 index 00000000..db1665a6 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/LUTBrowser.cs @@ -0,0 +1,237 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using System.IO; +using UnityEngine.Rendering; + +namespace Beautify.Universal { + + public class LUTBrowser : EditorWindow { + + const string MASTER_FOLDER_NAME = "LUT Pack"; + + Material referenceMaterial; + Vector2 scrollPos; + static int columnCount = 4; + VolumeProfile profile; + + struct LUTEntry { + public Material mat; + public Texture2D lutTex; + } + + struct LUTGroup { + public string categoryPath; + public string categoryName; + public List luts; + public bool visible; + } + LUTGroup[] groups; + + + [MenuItem("Window/Beautify/LUT Browser")] + public static void ShowBrowser() { + GetWindow("LUT Browser"); + } + + static class ShaderParams { + public static int lutTex = Shader.PropertyToID("_LUTTex"); + } + + private void OnEnable() { + RefreshLUTs(); + } + + private void OnGUI() { + + if (groups == null) { + EditorGUILayout.HelpBox("LUT Pack not found.", MessageType.Info); + if (GUILayout.Button("View LUT Pack on the Unity Asset Store")) { + Application.OpenURL("https://assetstore.unity.com/packages/slug/202502"); + } + if (GUILayout.Button("Reload LUT Pack")) { + RefreshLUTs(); + } + return; + } + + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Find LUTs")) { + RefreshLUTs(); + } + if (GUILayout.Button("Capture SceneView")) { + RequestCapture(CameraType.SceneView); + } + if (GUILayout.Button("Capture GameView")) { + RequestCapture(CameraType.Game); + } + EditorGUILayout.EndHorizontal(); + + if (profile == null) { + profile = BeautifySettings.currentProfile; + } + EditorGUILayout.BeginHorizontal(); + profile = (VolumeProfile)EditorGUILayout.ObjectField("Current Profile:", profile, typeof(VolumeProfile), false); + if (GUILayout.Button(new GUIContent("Auto Select", "Automatically selects the profile used in a scene volume using Beautify"), GUILayout.Width(90))) { + profile = null; + } + EditorGUILayout.EndHorizontal(); + + Texture2D wt = Texture2D.whiteTexture; + float rowHeight = 0.5f * EditorGUIUtility.currentViewWidth / columnCount; + + scrollPos = EditorGUILayout.BeginScrollView(scrollPos); + Beautify b = null; + if (profile != null) { + profile.TryGet(out b); + } + if (b == null) { + EditorGUILayout.HelpBox("Beautify not found in the seleced profile.", MessageType.Warning); + } else { + columnCount = EditorGUILayout.IntSlider("Columns:", columnCount, 1, 5); + EditorGUILayout.HelpBox("Click on the name of a LUT to toggle it on/off. Use the Intensity slider in Beautify inspector to customize the LUT strength.", MessageType.Info); + for (int k = 0; k < groups.Length; k++) { + groups[k].visible = EditorGUILayout.Foldout(groups[k].visible, "Category: " + groups[k].categoryName); + if (groups[k].visible) { + int c = groups[k].luts.Count; + int matIndex = 0; + while (matIndex < c) { + EditorGUILayout.BeginVertical(); + Rect rect = EditorGUILayout.GetControlRect(); + float w = rect.width / columnCount; + rect.width = w - 5; + for (int col = 0; col < columnCount; col++) { + if (matIndex < c) { + LUTEntry lutEntry = groups[k].luts[matIndex]; + if (lutEntry.mat != null) { + rect.height = rowHeight; + lutEntry.mat.SetTexture(ShaderParams.lutTex, lutEntry.lutTex); + EditorGUI.DrawPreviewTexture(rect, wt, lutEntry.mat); + rect.y += rowHeight; + rect.height = 15; + string lutName; + if (b.lut.value && b.lut.overrideState && b.lutTexture == lutEntry.lutTex) { + lutName = "✔ " + lutEntry.mat.name; + } else { + lutName = lutEntry.mat.name; + } + if (GUI.Button(rect, lutName)) { + if (b.lut.value && b.lut.overrideState && b.lutTexture == lutEntry.lutTex) { + b.lut.Override(false); + } else { + b.lut.Override(true); + if (!b.lutIntensity.overrideState) { + b.lutIntensity.Override(1f); + } + b.lutTexture.Override(lutEntry.lutTex); + } + EditorUtility.SetDirty(b); + if (!Application.isPlaying) { + UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); + } + } + rect.y -= rowHeight; + rect.x += w; + } + matIndex++; + } + } + GUILayout.Space(rowHeight); + EditorGUILayout.EndVertical(); + EditorGUILayout.Separator(); + } + } + } + } + EditorGUILayout.EndScrollView(); + } + + private void OnDestroy() { + ReleaseGroups(); + } + + void ReleaseGroups() { + if (groups != null) { + foreach (LUTGroup g in groups) { + if (g.luts != null) { + foreach (LUTEntry l in g.luts) { + if (l.mat != null) { + DestroyImmediate(l.mat); + } + } + g.luts.Clear(); + } + } + } + groups = null; + } + + void RequestCapture(CameraType cameraType) { + + BeautifySettings b; +#if UNITY_2023_1_OR_NEWER + b = FindAnyObjectByType(); +#else + b = FindObjectOfType(); +#endif + if (b == null) { + Debug.LogError("Beautify not found. It's requred for the LUT Browser functionality."); + return; + } + BeautifyRendererFeature.captureCameraType = cameraType; + BeautifyRendererFeature.requestScreenCapture = true; + EditorUtility.SetDirty(BeautifySettings.sharedSettings); + } + + + void RefreshLUTs() { + + RequestCapture(BeautifyRendererFeature.captureCameraType); + ReleaseGroups(); + if (referenceMaterial == null) { + referenceMaterial = new Material(Shader.Find("Hidden/Beautify/LUTThumbnail")); + } + string[] res = Directory.GetDirectories(Application.dataPath, "*" + MASTER_FOLDER_NAME + "*", SearchOption.AllDirectories); + string path = null; + for (int k = 0; k < res.Length; k++) { + if (res[k].Contains("LUT Pack")) { + path = res[k]; + break; + } + } + if (path == null) { + return; + } + string[] categories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); + groups = new LUTGroup[categories.Length]; + for (int c = 0; c < categories.Length; c++) { + LUTGroup group = new LUTGroup(); + group.categoryPath = categories[c]; + group.categoryName = Path.GetFileName(group.categoryPath); + group.luts = new List(); + string[] luts = Directory.GetFiles(group.categoryPath, "*.png", SearchOption.AllDirectories); + if (luts != null) { + for (int l = 0; l < luts.Length; l++) { + string lutPath = luts[l]; + int i = lutPath.IndexOf("/Assets"); + if (i < 0) continue; + lutPath = lutPath.Substring(i + 1); + Texture2D lutTex = AssetDatabase.LoadAssetAtPath(lutPath) as Texture2D; + if (lutTex != null) { + Material mat = Instantiate(referenceMaterial); + mat.name = Path.GetFileNameWithoutExtension(lutPath); + LUTEntry entry = new LUTEntry(); + entry.mat = mat; + entry.lutTex = lutTex; + group.luts.Add(entry); + } + } + } + groups[c] = group; + } + + } + + } + +} diff --git a/Assets/External/Beautify/URP/Editor/LUTBrowser.cs.meta b/Assets/External/Beautify/URP/Editor/LUTBrowser.cs.meta new file mode 100644 index 00000000..17167c40 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/LUTBrowser.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ea90863c340046bab9e7c20c63fb798 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/Resources.meta b/Assets/External/Beautify/URP/Editor/Resources.meta new file mode 100644 index 00000000..c1355d3e --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 587d57227e82a414c91432f5d37dfc30 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/Resources/FrameThumbnail.shader b/Assets/External/Beautify/URP/Editor/Resources/FrameThumbnail.shader new file mode 100644 index 00000000..6dbbae3e --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/FrameThumbnail.shader @@ -0,0 +1,64 @@ +Shader "Hidden/Beautify/FrameThumbnail" +{ + Properties + { + _MainTex ("Texture", 2D) = "white" {} + _Color ("Color", color) = (1,1,1,1) + _FrameMask ("Frame Mask", 2D) = "white" {} + } + SubShader + { + Tags { "RenderType"="Opaque" } + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + float2 clipUV : TEXCOORD1; + }; + + sampler2D _LUTPreview; + float4 _LUTPreview_ST; + sampler2D _GUIClipTexture; + uniform float4x4 unity_GUIClipTextureMatrix; + + sampler2D _FrameMask; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = v.uv; + float3 eyePos = UnityObjectToViewPos(v.vertex); + o.clipUV = mul(unity_GUIClipTextureMatrix, float4(eyePos.xy, 0, 1.0)); + return o; + } + + half4 frag (v2f i) : SV_Target + { + clip( tex2D(_GUIClipTexture, i.clipUV).a - 0.1); + + half3 rgb = tex2D(_LUTPreview, i.uv); + + half4 frameMask = tex2D(_FrameMask, i.uv); + rgb = lerp(rgb, frameMask.rgb, frameMask.a); + + return half4(rgb, 1.0); + } + ENDCG + } + } +} diff --git a/Assets/External/Beautify/URP/Editor/Resources/FrameThumbnail.shader.meta b/Assets/External/Beautify/URP/Editor/Resources/FrameThumbnail.shader.meta new file mode 100644 index 00000000..0452f739 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/FrameThumbnail.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 930de39fd5ebb4036af9ebca77f535be +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/Resources/LUTThumbnail.shader b/Assets/External/Beautify/URP/Editor/Resources/LUTThumbnail.shader new file mode 100644 index 00000000..fade108d --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/LUTThumbnail.shader @@ -0,0 +1,74 @@ +Shader "Hidden/Beautify/LUTThumbnail" +{ + Properties + { + _MainTex ("Texture", 2D) = "white" {} + _Color ("Color", color) = (1,1,1,1) + _LUTTex ("LUT Texture", 2D) = "black" {} + } + SubShader + { + Tags { "RenderType"="Opaque" } + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + float2 clipUV : TEXCOORD1; + }; + + sampler2D _LUTPreview; + float4 _LUTPreview_ST;; + sampler2D _GUIClipTexture; + uniform float4x4 unity_GUIClipTextureMatrix; + + sampler2D _LUTTex; + float4 _LUTTex_TexelSize; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = v.uv; + float3 eyePos = UnityObjectToViewPos(v.vertex); + o.clipUV = mul(unity_GUIClipTextureMatrix, float4(eyePos.xy, 0, 1.0)); + return o; + } + + half4 frag (v2f i) : SV_Target + { + clip( tex2D(_GUIClipTexture, i.clipUV).a - 0.1); + + half3 rgb = tex2D(_LUTPreview, i.uv); + + #if !UNITY_COLORSPACE_GAMMA + rgb = LinearToGammaSpace(rgb); + #endif + + float3 lutST = float3(_LUTTex_TexelSize.x, _LUTTex_TexelSize.y, _LUTTex_TexelSize.w - 1); + float3 lookUp = saturate(rgb) * lutST.zzz; + lookUp.xy = lutST.xy * (lookUp.xy + 0.5); + float slice = floor(lookUp.z); + lookUp.x += slice * lutST.y; + float2 lookUpNextSlice = float2(lookUp.x + lutST.y, lookUp.y); + rgb = lerp(tex2D(_LUTTex, lookUp.xy).rgb, tex2D(_LUTTex, lookUpNextSlice).rgb, lookUp.z - slice); + + return half4(rgb, 1.0); + } + ENDCG + } + } +} diff --git a/Assets/External/Beautify/URP/Editor/Resources/LUTThumbnail.shader.meta b/Assets/External/Beautify/URP/Editor/Resources/LUTThumbnail.shader.meta new file mode 100644 index 00000000..1c3edb47 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/LUTThumbnail.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 76e6e0fd1d4ad4cf7a9e2bd30b1675e1 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/Resources/beautifyHeader.png b/Assets/External/Beautify/URP/Editor/Resources/beautifyHeader.png new file mode 100644 index 00000000..e8f6692d --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/beautifyHeader.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a01f75bff6c54682a136fa816166a66d5fcad97e48c56eeb0d703c6ed970764 +size 2368 diff --git a/Assets/External/Beautify/URP/Editor/Resources/beautifyHeader.png.meta b/Assets/External/Beautify/URP/Editor/Resources/beautifyHeader.png.meta new file mode 100644 index 00000000..f43292dc --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/beautifyHeader.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 6dd9cc9aaf47c43bea25b8a6e9df73d9 +timeCreated: 1462519611 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/Resources/kronnectLogo.png b/Assets/External/Beautify/URP/Editor/Resources/kronnectLogo.png new file mode 100644 index 00000000..179f018d --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/kronnectLogo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aef53609db148801623c42600a1b37624d288aec65c1d98a7ca1c95e104e81fb +size 17915 diff --git a/Assets/External/Beautify/URP/Editor/Resources/kronnectLogo.png.meta b/Assets/External/Beautify/URP/Editor/Resources/kronnectLogo.png.meta new file mode 100644 index 00000000..e0f73ad9 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/kronnectLogo.png.meta @@ -0,0 +1,111 @@ +fileFormatVersion: 2 +guid: e631d30559be7400bafa5c6d66ad4824 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 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: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Editor/Resources/welcomeBanner.png b/Assets/External/Beautify/URP/Editor/Resources/welcomeBanner.png new file mode 100644 index 00000000..88b87412 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/welcomeBanner.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df7984b1d5bb8318afe18ee0b8a5ad68563735fa78c21ba1e8a26819456e9891 +size 539071 diff --git a/Assets/External/Beautify/URP/Editor/Resources/welcomeBanner.png.meta b/Assets/External/Beautify/URP/Editor/Resources/welcomeBanner.png.meta new file mode 100644 index 00000000..92c48377 --- /dev/null +++ b/Assets/External/Beautify/URP/Editor/Resources/welcomeBanner.png.meta @@ -0,0 +1,111 @@ +fileFormatVersion: 2 +guid: ad40dcebc3b024c5eabbae1b82de8979 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + 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 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/README.txt b/Assets/External/Beautify/URP/README.txt new file mode 100644 index 00000000..a687fc33 --- /dev/null +++ b/Assets/External/Beautify/URP/README.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:944f1391ce094d032cd997a40c8132b9570fb18e5a19c3f99fabe1ffae3116b0 +size 11763 diff --git a/Assets/External/Beautify/URP/README.txt.meta b/Assets/External/Beautify/URP/README.txt.meta new file mode 100644 index 00000000..1c17ac5c --- /dev/null +++ b/Assets/External/Beautify/URP/README.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3c034cc80ca524a40b59335501a9adfe +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime.meta b/Assets/External/Beautify/URP/Runtime.meta new file mode 100644 index 00000000..36114a8d --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 820c4942f0a864f0081f41ee03106463 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Beautify.cs b/Assets/External/Beautify/URP/Runtime/Beautify.cs new file mode 100644 index 00000000..46e01240 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Beautify.cs @@ -0,0 +1,1198 @@ +using System; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +namespace Beautify.Universal { + + [ExecuteInEditMode, VolumeComponentMenu("Kronnect/Beautify")] + public class Beautify : VolumeComponent, IPostProcessComponent { + + [AttributeUsage(AttributeTargets.Field)] + public class SectionGroup : Attribute { + } + + [AttributeUsage(AttributeTargets.Field)] + public class SettingsGroup : Attribute { + + bool? expanded; + + public bool IsExpanded { + get { +#if UNITY_EDITOR + if (!expanded.HasValue) { + expanded = UnityEditor.EditorPrefs.GetBool("BeautifyURP" + GetType().ToString(), false); + } + return expanded.Value; +#else + return false; +#endif + } + set { +#if UNITY_EDITOR + if (expanded.Value != value) { + expanded = value; + UnityEditor.EditorPrefs.SetBool("BeautifyURP" + GetType().ToString(), value); + } +#endif + } + } + + } + + public class GeneralSettings : SectionGroup { } + public class ImageEnhancement : SectionGroup { } + public class TonemappingAndColorGrading : SectionGroup { } + public class LensAndLightingEffects : SectionGroup { } + public class ArtisticChoices : SectionGroup { } + + public class OptimizeBeautifyBuild : SettingsGroup { } + public class OptimizeUnityPostProcessingBuild : SettingsGroup { } + public class Performance : SettingsGroup { } + public class Dither : SettingsGroup { } + public class Sharpen : SettingsGroup { } + public class EdgeAntialiasing : SettingsGroup { } + public class TonemapSettings : SettingsGroup { } + public class WhiteBalance : SettingsGroup { } + public class LUT : SettingsGroup { } + public class Bloom : SettingsGroup { } + public class AnamorphicFlares : SettingsGroup { } + public class SunFlares : SettingsGroup { } + public class LensDirt : SettingsGroup { } + public class ChromaticAberration : SettingsGroup { } + public class DepthOfField : SettingsGroup { } + public class EyeAdaptation : SettingsGroup { } + public class PurkinjeShift : SettingsGroup { } + + public class Vignette : SettingsGroup { } + public class Outline : SettingsGroup { } + public class NightVision : SettingsGroup { } + public class ThermalVision : SettingsGroup { } + public class FilmGrainAndArtifacts : SettingsGroup { } + public class FinalBlur : SettingsGroup { } + public class Frame : SettingsGroup { } + + + [AttributeUsage(AttributeTargets.Field)] + public class DisplayName : Attribute { + public string name; + + public DisplayName(string name) { + this.name = name; + } + } + + [AttributeUsage(AttributeTargets.Field)] + public class DisplayConditionEnum : Attribute { + public string field; + public int enumValueIndex; + public bool isEqual; + + public DisplayConditionEnum(string field, int enumValueIndex, bool isEqual = true) { + this.field = field; + this.enumValueIndex = enumValueIndex; + this.isEqual = isEqual; + } + } + + + [AttributeUsage(AttributeTargets.Field)] + public class DisplayConditionBool : Attribute { + public string field; + public bool value; + public string field2; + public bool value2; + + public DisplayConditionBool(string field, bool value = true, string field2 = null, bool value2 = true) { + this.field = field; + this.value = value; + this.field2 = field2; + this.value2 = value2; + } + } + + + [AttributeUsage(AttributeTargets.Field)] + public class ToggleAllFields : Attribute { + } + + + [AttributeUsage(AttributeTargets.Field)] + public class GlobalOverride : Attribute { + } + + [AttributeUsage(AttributeTargets.Field)] + public class ShowStrippedLabel : Attribute { + } + + public enum CompareStyle { + FreeAngle, + VerticalLine, + SameSide + } + + public enum TonemapOperator { + Linear = 0, + ACESFitted = 1, + ACES = 2, + AGX = 3 + } + + public enum DoFFocusMode { + FixedDistance, + AutoFocus, + FollowTarget + } + + public enum DoFTargetFallback { + KeepCurrentFocalDistance, + SwitchToAutofocus, + FixedDistanceFocus + } + + public enum DoFBokehComposition { + Integrated, + Separated + } + + public enum DoFCameraSettings { + Classic, + Real + } + + public enum VignetteFitMode { + FitToWidth, + FitToHeight + } + + public enum DebugOutput { + Nothing, + BloomAndFlares = 10, + BloomExclusionPass = 11, + AnamorphicFlaresExclusionPass = 12, + DepthOfFieldCoC = 20, + DepthOfFieldTransparentPass = 21 + } + + public enum BlinkStyle { + Cutscene, + Human + } + + public enum OutlineStage { + BeforeBloom = 0, + AfterBloom = 10 + } + + public enum OutlineTechnique { + Depth = 0, + PerObjectId = 1 + } + + public enum DownsamplingMode { + BeautifyEffectsOnly = 0, + FullFrame = 10 + } + + public enum SunFlaresDepthOcclusionMode { + None, + Simple, + Smooth + } + + public enum BloomLayersFilterMethod { + SelectedLayersOnly, + ExcludeSelectedLayers + } + + public enum EyeAdaptationMeteringMode { + FullFrame, + Mask + } + + [Serializable] + public sealed class BeautifyCompareStyleParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyDownsamplingModeParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyTonemapOperatorParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyDoFFocusModeParameter : VolumeParameter { } + + [Serializable] + public sealed class DoFTargetFallbackParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyDoFFilterModeParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyDoFBokehCompositionParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyDoFCameraSettingsParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyLayerMaskParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyDebugOutputParameter : VolumeParameter { + public BeautifyDebugOutputParameter(DebugOutput debugOutput = DebugOutput.Nothing, bool overrideState = false) : base(debugOutput, overrideState) { } + } + + [Serializable] + public sealed class BeautifyBlinkStyleParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyVignetteFitModeParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifySunFlaresDepthOcclusionModeParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyEyeAdaptationMeteringModeParameter : VolumeParameter { } + + [Serializable] + public sealed class MinMaxFloatParameter : VolumeParameter { + public float min; + public float max; + + public MinMaxFloatParameter(Vector2 value, float min, float max, bool overrideState = false) + : base(value, overrideState) { + this.min = min; + this.max = max; + } + } + + + [Serializable] + public sealed class BeautifyBloomLayersFilterMethodParameter : VolumeParameter { } + + + #region General settings + + [GeneralSettings, DisplayName("Disable Beautify Effects"), GlobalOverride, Tooltip("Ignore all Beautify effects. This option overrides any existing profile.")] + public BoolParameter disabled = new BoolParameter(false, overrideState: true); + + [GeneralSettings, DisplayName("Enable Compare Mode"), ToggleAllFields, GlobalOverride] + public BoolParameter compareMode = new BoolParameter(false, overrideState: true); + + [GeneralSettings, DisplayName("Style"), DisplayConditionBool("compareMode")] + public BeautifyCompareStyleParameter compareStyle = new BeautifyCompareStyleParameter(); + + [GeneralSettings, DisplayName("Panning"), DisplayConditionEnum("compareStyle", (int)CompareStyle.FreeAngle, false)] + public ClampedFloatParameter comparePanning = new ClampedFloatParameter(0.25f, 0, 0.5f); + + [GeneralSettings, DisplayName("Angle"), DisplayConditionEnum("compareStyle", (int)CompareStyle.FreeAngle, true)] + public FloatParameter compareLineAngle = new ClampedFloatParameter(1.4f, -Mathf.PI, Mathf.PI); + + [GeneralSettings, DisplayName("Line Width"), DisplayConditionBool("compareMode")] + public FloatParameter compareLineWidth = new ClampedFloatParameter(0.002f, 0.0001f, 0.05f); + + [GeneralSettings, DisplayName("Flip Vertically"), GlobalOverride, Tooltip("Inverts vertical orientation of image when blitting. This option can be used to overcome an issue in certain versions of URP.")] + public BoolParameter flipY = new BoolParameter(false, overrideState: true); + + [GeneralSettings, DisplayName("Hide In SceneView"), GlobalOverride] + public BoolParameter hideInSceneView = new BoolParameter(false, overrideState: true); + + [GeneralSettings, DisplayName("Debug Output"), GlobalOverride, DisplayConditionBool("compareMode", false)] + public BeautifyDebugOutputParameter debugOutput = new BeautifyDebugOutputParameter(); + + [GeneralSettings, Performance, DisplayName("Prioritize Shader Performance"), GlobalOverride, Tooltip("Sharpen, bloom and anamorphic flares will reduce quality a bit to improve performance. This option can be useful on less powerful platforms or devices.")] + public BoolParameter turboMode = new BoolParameter(false, overrideState: true); + + [GeneralSettings, Performance, DisplayName("Direct Write To Camera"), GlobalOverride, Tooltip("Writes result directly to camera target saving intermediate blits. This option will overwrite any previous post-processing effects so make sure there's no other effects being executed besides Beautify.")] + public BoolParameter directWrite = new BoolParameter(false, overrideState: true); + + [GeneralSettings, Performance, DisplayName("Ignore Depth Texture"), GlobalOverride, Tooltip("Doesn't request depth texture - effects or options that rely on depth will be disabled.")] + public BoolParameter ignoreDepthTexture = new BoolParameter(false, overrideState: true); + + [GeneralSettings, Performance, DisplayName("Downsampling"), GlobalOverride, Tooltip("Reduces camera target before applying Beautify effects This option can contribute to compensate render scale if it's set to greater than 1 or to improve performance.")] + public BoolParameter downsampling = new BoolParameter(false, overrideState: true); + + [GeneralSettings, Performance, DisplayName("Mode"), GlobalOverride, Tooltip("How downsampling is applied."), DisplayConditionBool("downsampling")] + public BeautifyDownsamplingModeParameter downsamplingMode = new BeautifyDownsamplingModeParameter { value = DownsamplingMode.BeautifyEffectsOnly }; + + [GeneralSettings, Performance, DisplayName("Multiplier"), GlobalOverride, Tooltip("Downsampling multiplier."), DisplayConditionBool("downsampling")] + public ClampedFloatParameter downsamplingMultiplier = new ClampedFloatParameter(1, 1, 64f); + + [GeneralSettings, Performance, DisplayName("Bilinear Filtering"), GlobalOverride, Tooltip("Enables bilinear filtering when using downsampling."), DisplayConditionBool("downsampling")] + public BoolParameter downsamplingBilinear = new BoolParameter(false); + + #endregion + + #region Sharpen settings + + [ImageEnhancement, Sharpen, DisplayName("Intensity"), ShowStrippedLabel] + public ClampedFloatParameter sharpenIntensity = new ClampedFloatParameter(0f, 0f, 25f); + + [ImageEnhancement, Sharpen, DisplayName("Depth Threshold"), DisplayConditionBool("turboMode", false, "ignoreDepthTexture", false), Tooltip("By default, sharpen ignores edges to avoid aliasing. Increase this property to also include edges. Edge detection is based on scene depth.")] + public ClampedFloatParameter sharpenDepthThreshold = new ClampedFloatParameter(0.035f, 0f, 0.05f); + + [ImageEnhancement, Sharpen, DisplayName("Depth Range"), DisplayConditionBool("turboMode", false, "ignoreDepthTexture", false), Tooltip("Restricts sharpen to a scene depth range.")] + public MinMaxFloatParameter sharpenMinMaxDepth = new MinMaxFloatParameter(new Vector2(0, 0.999f), 0, 1.1f); + + [ImageEnhancement, Sharpen, DisplayName("Depth Range FallOff"), DisplayConditionBool("turboMode", false, "ignoreDepthTexture", false)] + public ClampedFloatParameter sharpenMinMaxDepthFallOff = new ClampedFloatParameter(0f, 0f, 1f); + + [ImageEnhancement, Sharpen, DisplayName("Relaxation"), Tooltip("Reduces sharpen intensity based on area brightness.")] + public ClampedFloatParameter sharpenRelaxation = new ClampedFloatParameter(0.08f, 0, 0.2f); + + [ImageEnhancement, Sharpen, DisplayName("Clamp"), Tooltip("Reduces final sharpen modifier.")] + public ClampedFloatParameter sharpenClamp = new ClampedFloatParameter(0.45f, 0, 1f); + + [ImageEnhancement, Sharpen, DisplayName("Motion Sensibility"), Tooltip("Reduces sharpen gracefully when camera moves or rotates. This setting reduces flickering while contributes to a motion blur sense.")] + public ClampedFloatParameter sharpenMotionSensibility = new ClampedFloatParameter(0.5f, 0, 1f); + + [ImageEnhancement, Sharpen, DisplayName("Motion Restore Speed"), Tooltip("The speed at which the sharpen intensity restores when camera stops moving.")] + public ClampedFloatParameter sharpenMotionRestoreSpeed = new ClampedFloatParameter(0.5f, 0.01f, 5f); + + [ImageEnhancement, Sharpen, DisplayName("Exclusion Layers"), Tooltip("Layers to exclude from sharpening."), ShowStrippedLabel] + public BeautifyLayerMaskParameter sharpenExclusionLayerMask = new BeautifyLayerMaskParameter { value = 0 }; + + #endregion + + #region Edge AA + + [ImageEnhancement, EdgeAntialiasing, DisplayName("Strength"), DisplayConditionBool("ignoreDepthTexture", false), Tooltip("Strength of the integrated edge antialiasing. A value of 0 disables this feature."), ShowStrippedLabel] + public ClampedFloatParameter antialiasStrength = new ClampedFloatParameter(0, 0, 20); + + [ImageEnhancement, EdgeAntialiasing, DisplayName("Edge Threshold"), Tooltip("Minimum difference in depth between neighbour pixels to determine if edge antialiasing should be applied.")] + public ClampedFloatParameter antialiasDepthThreshold = new ClampedFloatParameter(0.000001f, 0, 0.001f); + + [ImageEnhancement, EdgeAntialiasing, DisplayName("Max Spread"), Tooltip("The maximum extent of antialiasing.")] + public ClampedFloatParameter antialiasSpread = new ClampedFloatParameter(3f, 0.1f, 8f); + + [ImageEnhancement, EdgeAntialiasing, DisplayName("Depth Attenuation"), Tooltip("Reduces antialias effect on the distance.")] + public FloatParameter antialiasDepthAttenuation = new FloatParameter(0); + + #endregion + + #region Tonemapping and Color Grading + + [TonemappingAndColorGrading, ShowStrippedLabel] + public BeautifyTonemapOperatorParameter tonemap = new BeautifyTonemapOperatorParameter { value = TonemapOperator.Linear }; + + [TonemappingAndColorGrading, DisplayName("Gamma"), Tooltip("Gamma applied to the AGX tonemapper."), DisplayConditionEnum("tonemap", (int)TonemapOperator.AGX, true)] + public FloatParameter tonemapAGXGamma = new ClampedFloatParameter(2.5f, 0, 5f); + + [TonemappingAndColorGrading, Min(0), DisplayName("Max Input Brightness"), Tooltip("Clamps input image brightness to avoid artifacts due to NaN or out of range pixel values."), DisplayConditionEnum("tonemap", (int)TonemapOperator.Linear, false)] + public FloatParameter tonemapMaxInputBrightness = new FloatParameter(1000f); + + [TonemappingAndColorGrading, Min(0), DisplayName("Pre Exposure"), Tooltip("Brightness multiplier before applying tonemap operator."), DisplayConditionEnum("tonemap", (int)TonemapOperator.Linear, false)] + public FloatParameter tonemapExposurePre = new FloatParameter(1f); + + [TonemappingAndColorGrading, Min(0), DisplayName("Post Brightness"), Tooltip("Brightness multiplier after applying tonemap operator."), DisplayConditionEnum("tonemap", (int)TonemapOperator.Linear, false)] + public FloatParameter tonemapBrightnessPost = new FloatParameter(1f); + + [TonemappingAndColorGrading] + public ClampedFloatParameter saturate = new ClampedFloatParameter(1f, -2f, 3f); + + [TonemappingAndColorGrading] + public ClampedFloatParameter brightness = new ClampedFloatParameter(1.0f, 0f, 2f); + + [TonemappingAndColorGrading] + public ClampedFloatParameter contrast = new ClampedFloatParameter(1.0f, 0.5f, 1.5f); + + [TonemappingAndColorGrading, ShowStrippedLabel] + public ClampedFloatParameter daltonize = new ClampedFloatParameter(0f, 0f, 2f); + + [TonemappingAndColorGrading, ShowStrippedLabel] + public ClampedFloatParameter sepia = new ClampedFloatParameter(0f, 0f, 1f); + + [TonemappingAndColorGrading] + public ColorParameter tintColor = new ColorParameter(new Color(1, 1, 1, 0)); + + [TonemappingAndColorGrading, WhiteBalance, DisplayName("Blend"), ShowStrippedLabel] + public ClampedFloatParameter colorTempBlend = new ClampedFloatParameter(0f, 0f, 1f); + + [TonemappingAndColorGrading, WhiteBalance, DisplayName("Temperature")] + public ClampedFloatParameter colorTemp = new ClampedFloatParameter(6550f, 1000f, 40000f); + + #endregion + + #region LUT + + [TonemappingAndColorGrading, LUT, DisplayName("Enable LUT"), ToggleAllFields, ShowStrippedLabel] + public BoolParameter lut = new BoolParameter(false); + + [TonemappingAndColorGrading, LUT, DisplayName("Intensity")] + public ClampedFloatParameter lutIntensity = new ClampedFloatParameter(0f, 0, 1f); + + [TonemappingAndColorGrading, LUT, DisplayName("LUT Texture")] + public TextureParameter lutTexture = new TextureParameter(null); + + #endregion + + #region Bloom + + [LensAndLightingEffects, Bloom, DisplayName("Intensity"), ShowStrippedLabel] + public FloatParameter bloomIntensity = new FloatParameter(0); + + [LensAndLightingEffects, Bloom, DisplayName("Threshold")] + public FloatParameter bloomThreshold = new FloatParameter(0.75f); + + [LensAndLightingEffects, Bloom, DisplayName("Conservative Threshold"), Tooltip("A convervative threshold keeps the ratio of the rgb values after applying the thresholding")] + public BoolParameter bloomConservativeThreshold = new BoolParameter(false); + + [LensAndLightingEffects, Bloom, DisplayName("Spread")] + public ClampedFloatParameter bloomSpread = new ClampedFloatParameter(0.5f, 0, 1); + + [LensAndLightingEffects, Bloom, DisplayName("Max Brightness")] + public FloatParameter bloomMaxBrightness = new FloatParameter(1000f); + + [LensAndLightingEffects, Bloom, DisplayName("Tint Color"), Tooltip("Use Alpha channel to blend original bloom color with the tinted color.")] + public ColorParameter bloomTint = new ColorParameter(new Color(0.5f, 0.5f, 1f, 0f)); + + [LensAndLightingEffects, Bloom, DisplayName("Depth Attenuation"), DisplayConditionBool("ignoreDepthTexture", false)] + public FloatParameter bloomDepthAtten = new FloatParameter(0f); + + [LensAndLightingEffects, Bloom, DisplayName("Near Attenuation"), DisplayConditionBool("ignoreDepthTexture", false), Min(0)] + public FloatParameter bloomNearAtten = new FloatParameter(0f); + + [LensAndLightingEffects, Bloom, DisplayName("Use Layers"), DisplayConditionBool("ignoreDepthTexture", false)] + public BoolParameter bloomExcludeLayers = new BoolParameter(false); + + [LensAndLightingEffects, Bloom, DisplayName("Include/Exclude Layers"), DisplayConditionBool("bloomExcludeLayers", true, "ignoreDepthTexture", false), Tooltip("Choose if bloom should be applied only to specified layers or if bloom should be excluded from the specified layers.")] + public BeautifyBloomLayersFilterMethodParameter bloomLayersFilterMethod = new BeautifyBloomLayersFilterMethodParameter { value = BloomLayersFilterMethod.ExcludeSelectedLayers }; + + [LensAndLightingEffects, Bloom, DisplayName("Layers"), DisplayConditionBool("bloomExcludeLayers", true, "ignoreDepthTexture", false)] + public BeautifyLayerMaskParameter bloomExclusionLayerMask = new BeautifyLayerMaskParameter { value = 0 }; + + [LensAndLightingEffects, Bloom, DisplayName("Antiflicker")] + public BoolParameter bloomAntiflicker = new BoolParameter(false); + + [LensAndLightingEffects, Bloom, DisplayName("Resolution")] + public ClampedIntParameter bloomResolution = new ClampedIntParameter(1, 1, 10); + + [LensAndLightingEffects, Bloom, DisplayName("Quicker Blur")] + public BoolParameter bloomQuickerBlur = new BoolParameter(false); + + [LensAndLightingEffects, Bloom, DisplayName("Customize"), ToggleAllFields] + public BoolParameter bloomCustomize = new BoolParameter(false); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 1 Weight")] + public ClampedFloatParameter bloomWeight0 = new ClampedFloatParameter(0.5f, 0, 1f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 1 Boost")] + public ClampedFloatParameter bloomBoost0 = new ClampedFloatParameter(0f, 0, 3f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 1 Tint Color")] + [ColorUsage(false, true)] + public ColorParameter bloomTint0 = new ColorParameter(Color.white); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 2 Weight")] + public ClampedFloatParameter bloomWeight1 = new ClampedFloatParameter(0.5f, 0, 1f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 2 Boost")] + public ClampedFloatParameter bloomBoost1 = new ClampedFloatParameter(0f, 0, 3f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 2 Tint Color")] + [ColorUsage(false, true)] + public ColorParameter bloomTint1 = new ColorParameter(Color.white); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 3 Weight")] + public ClampedFloatParameter bloomWeight2 = new ClampedFloatParameter(0.5f, 0, 1f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 3 Boost")] + public ClampedFloatParameter bloomBoost2 = new ClampedFloatParameter(0f, 0, 3f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 3 Tint Color")] + [ColorUsage(false, true)] + public ColorParameter bloomTint2 = new ColorParameter(Color.white); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 4 Weight")] + public ClampedFloatParameter bloomWeight3 = new ClampedFloatParameter(0.5f, 0, 1f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 4 Boost")] + public ClampedFloatParameter bloomBoost3 = new ClampedFloatParameter(0f, 0, 3f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 4 Tint Color")] + [ColorUsage(false, true)] + public ColorParameter bloomTint3 = new ColorParameter(Color.white); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 5 Weight")] + public ClampedFloatParameter bloomWeight4 = new ClampedFloatParameter(0.5f, 0, 1f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 5 Boost")] + public ClampedFloatParameter bloomBoost4 = new ClampedFloatParameter(0f, 0, 3f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 5 Tint Color")] + [ColorUsage(false, true)] + public ColorParameter bloomTint4 = new ColorParameter(Color.white); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 6 Weight")] + public ClampedFloatParameter bloomWeight5 = new ClampedFloatParameter(0.5f, 0, 1f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 6 Boost")] + public ClampedFloatParameter bloomBoost5 = new ClampedFloatParameter(0f, 0, 3f); + + [LensAndLightingEffects, Bloom, DisplayName("Layer 6 Tint Color")] + [ColorUsage(false, true)] + public ColorParameter bloomTint5 = new ColorParameter(Color.white); + + + #endregion + + #region Anamorphic flares + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Intensity"), ShowStrippedLabel] + public FloatParameter anamorphicFlaresIntensity = new FloatParameter(0f); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Threshold")] + public FloatParameter anamorphicFlaresThreshold = new FloatParameter(0.75f); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Conservative Threshold"), Tooltip("A convervative threshold keeps the ratio of the rgb values after applying the thresholding")] + public BoolParameter anamorphicFlaresConservativeThreshold = new BoolParameter(false); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Tint Color"), Tooltip("Ignore all Beautify effects. This option overrides any existing profile.")] + public ColorParameter anamorphicFlaresTint = new ColorParameter(new Color(0.5f, 0.5f, 1f, 0f)); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Vertical")] + public BoolParameter anamorphicFlaresVertical = new BoolParameter(false); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Spread")] + public ClampedFloatParameter anamorphicFlaresSpread = new ClampedFloatParameter(1f, 0.1f, 2f); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Max Brightness")] + public FloatParameter anamorphicFlaresMaxBrightness = new FloatParameter(1000f); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Depth Attenuation"), DisplayConditionBool("ignoreDepthTexture", false)] + public FloatParameter anamorphicFlaresDepthAtten = new FloatParameter(0f); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Near Attenuation"), DisplayConditionBool("ignoreDepthTexture", false), Min(0)] + public FloatParameter anamorphicFlaresNearAtten = new FloatParameter(0f); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Use Layers"), DisplayConditionBool("ignoreDepthTexture", false)] + public BoolParameter anamorphicFlaresExcludeLayers = new BoolParameter(false); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Include/Exclude Layers"), DisplayConditionBool("anamorphicFlaresExcludeLayers", true, "ignoreDepthTexture", false), Tooltip("Choose if the effect should be applied only on the specified layers or if it should be excluded instead.")] + public BeautifyBloomLayersFilterMethodParameter anamorphicFlaresLayersFilterMethod = new BeautifyBloomLayersFilterMethodParameter { value = BloomLayersFilterMethod.ExcludeSelectedLayers }; + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Layers"), DisplayConditionBool("anamorphicFlaresExcludeLayers", true, "ignoreDepthTexture", false)] + public BeautifyLayerMaskParameter anamorphicFlaresExclusionLayerMask = new BeautifyLayerMaskParameter { value = 0 }; + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Antiflicker")] + public BoolParameter anamorphicFlaresAntiflicker = new BoolParameter(false); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Resolution")] + public ClampedIntParameter anamorphicFlaresResolution = new ClampedIntParameter(1, 1, 10); + + [LensAndLightingEffects, AnamorphicFlares, DisplayName("Quicker Blur")] + public BoolParameter anamorphicFlaresQuickerBlur = new BoolParameter(false); + + #endregion + + #region Sun Flares + + [LensAndLightingEffects, SunFlares, DisplayName("Global Intensity"), ShowStrippedLabel] + public ClampedFloatParameter sunFlaresIntensity = new ClampedFloatParameter(0.0f, 0, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Tint Color")] + public ColorParameter sunFlaresTint = new ColorParameter(new Color(1, 1, 1)); + + [LensAndLightingEffects, SunFlares, DisplayName("Solar Wind Speed")] + public ClampedFloatParameter sunFlaresSolarWindSpeed = new ClampedFloatParameter(0.01f, 0, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Rotation Dead Zone")] + public BoolParameter sunFlaresRotationDeadZone = new BoolParameter(false); + + [LensAndLightingEffects, SunFlares, DisplayName("Downsampling")] + public ClampedIntParameter sunFlaresDownsampling = new ClampedIntParameter(1, 1, 5); + + [LensAndLightingEffects, SunFlares, DisplayName("Depth Occlusion Mode"), DisplayConditionBool("ignoreDepthTexture", false), Tooltip("None = no depth buffer checking. Simple = sample depth buffer at Sun position. Smooth = sample 4 positions around Sun position and interpolate value across frames.")] + public BeautifySunFlaresDepthOcclusionModeParameter sunFlaresDepthOcclusionMode = new BeautifySunFlaresDepthOcclusionModeParameter { value = SunFlaresDepthOcclusionMode.Simple }; + + [LensAndLightingEffects, SunFlares, DisplayName("Occlusion Threshold"), DisplayConditionEnum("sunFlaresDepthOcclusionMode", (int)SunFlaresDepthOcclusionMode.Smooth)] + public ClampedFloatParameter sunFlaresDepthOcclusionThreshold = new ClampedFloatParameter(0.5f, 0, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Use Layer Mask"), Tooltip("Specifies if occluding objects will be detected by raycasting.")] + public BoolParameter sunFlaresUseLayerMask = new BoolParameter(false); + + [LensAndLightingEffects, SunFlares, DisplayName("Occluding Layer Mask"), DisplayConditionBool("sunFlaresUseLayerMask")] + public BeautifyLayerMaskParameter sunFlaresLayerMask = new BeautifyLayerMaskParameter { value = -1 }; + + [LensAndLightingEffects, SunFlares, DisplayName("Occlusion Speed"), DisplayConditionBool("sunFlaresUseLayerMask"), DisplayConditionEnum("sunFlaresDepthOcclusionMode", (int)SunFlaresDepthOcclusionMode.Smooth)] + public FloatParameter sunFlaresAttenSpeed = new FloatParameter(30f); + + [Header("Sun"), LensAndLightingEffects, SunFlares, DisplayName("Intensity")] + public ClampedFloatParameter sunFlaresSunIntensity = new ClampedFloatParameter(0.1f, 0, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Disk Size")] + public ClampedFloatParameter sunFlaresSunDiskSize = new ClampedFloatParameter(0.05f, 0, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Diffraction Intensity")] + public ClampedFloatParameter sunFlaresSunRayDiffractionIntensity = new ClampedFloatParameter(3.5f, 0, 25f); + + [LensAndLightingEffects, SunFlares, DisplayName("Diffraction Threshold")] + public ClampedFloatParameter sunFlaresSunRayDiffractionThreshold = new ClampedFloatParameter(0.13f, 0, 1f); + + [Header("Corona Rays Group 1"), LensAndLightingEffects, SunFlares, DisplayName("Length")] + public ClampedFloatParameter sunFlaresCoronaRays1Length = new ClampedFloatParameter(0.02f, 0, 0.2f); + + [LensAndLightingEffects, SunFlares, DisplayName("Streaks")] + public ClampedIntParameter sunFlaresCoronaRays1Streaks = new ClampedIntParameter(12, 2, 30); + + [LensAndLightingEffects, SunFlares, DisplayName("Spread")] + public ClampedFloatParameter sunFlaresCoronaRays1Spread = new ClampedFloatParameter(0.001f, 0, 0.1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Angle Offset")] + public ClampedFloatParameter sunFlaresCoronaRays1AngleOffset = new ClampedFloatParameter(0f, 0, 2f * Mathf.PI); + + [Header("Corona Rays Group 2"), LensAndLightingEffects, SunFlares, DisplayName("Length")] + public ClampedFloatParameter sunFlaresCoronaRays2Length = new ClampedFloatParameter(0.05f, 0, 0.2f); + + [LensAndLightingEffects, SunFlares, DisplayName("Streaks")] + public ClampedIntParameter sunFlaresCoronaRays2Streaks = new ClampedIntParameter(12, 2, 30); + + [LensAndLightingEffects, SunFlares, DisplayName("Spread")] + public ClampedFloatParameter sunFlaresCoronaRays2Spread = new ClampedFloatParameter(0.1f, 0, 0.1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Angle Offset")] + public ClampedFloatParameter sunFlaresCoronaRays2AngleOffset = new ClampedFloatParameter(0f, 0, 2f * Mathf.PI); + + [Header("Ghost 1"), LensAndLightingEffects, SunFlares, DisplayName("Size")] + public ClampedFloatParameter sunFlaresGhosts1Size = new ClampedFloatParameter(0.03f, 0f, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Offset")] + public ClampedFloatParameter sunFlaresGhosts1Offset = new ClampedFloatParameter(1.04f, -3f, 3f); + + [LensAndLightingEffects, SunFlares, DisplayName("Brightness")] + public ClampedFloatParameter sunFlaresGhosts1Brightness = new ClampedFloatParameter(0.037f, 0f, 1f); + + [Header("Ghost 2"), LensAndLightingEffects, SunFlares, DisplayName("Size")] + public ClampedFloatParameter sunFlaresGhosts2Size = new ClampedFloatParameter(0.1f, 0f, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Offset")] + public ClampedFloatParameter sunFlaresGhosts2Offset = new ClampedFloatParameter(0.71f, -3f, 3f); + + [LensAndLightingEffects, SunFlares, DisplayName("Brightness")] + public ClampedFloatParameter sunFlaresGhosts2Brightness = new ClampedFloatParameter(0.03f, 0f, 1f); + + [Header("Ghost 3"), LensAndLightingEffects, SunFlares, DisplayName("Size")] + public ClampedFloatParameter sunFlaresGhosts3Size = new ClampedFloatParameter(0.24f, 0, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Offset")] + public ClampedFloatParameter sunFlaresGhosts3Offset = new ClampedFloatParameter(0.31f, -3f, 3f); + + [LensAndLightingEffects, SunFlares, DisplayName("Brightness")] + public ClampedFloatParameter sunFlaresGhosts3Brightness = new ClampedFloatParameter(0.025f, 0f, 1f); + + [Header("Ghost 4"), LensAndLightingEffects, SunFlares, DisplayName("Size")] + public ClampedFloatParameter sunFlaresGhosts4Size = new ClampedFloatParameter(0.016f, 0f, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Offset")] + public ClampedFloatParameter sunFlaresGhosts4Offset = new ClampedFloatParameter(0f, -3f, 3f); + + [LensAndLightingEffects, SunFlares, DisplayName("Brightness")] + public ClampedFloatParameter sunFlaresGhosts4Brightness = new ClampedFloatParameter(0.017f, 0, 1f); + + [Header("Halo"), LensAndLightingEffects, SunFlares, DisplayName("Offset")] + public ClampedFloatParameter sunFlaresHaloOffset = new ClampedFloatParameter(0.22f, 0, 1f); + + [LensAndLightingEffects, SunFlares, DisplayName("Amplitude")] + public ClampedFloatParameter sunFlaresHaloAmplitude = new ClampedFloatParameter(15.1415f, 0, 50f); + + [LensAndLightingEffects, SunFlares, DisplayName("Intensity")] + public ClampedFloatParameter sunFlaresHaloIntensity = new ClampedFloatParameter(0.01f, 0, 1f); + + #endregion + + #region Lens Dirt + + [LensAndLightingEffects, LensDirt, DisplayName("Intensity"), Min(0), ShowStrippedLabel] + public FloatParameter lensDirtIntensity = new FloatParameter(0f); + + [LensAndLightingEffects, LensDirt, DisplayName("Threshold")] + public ClampedFloatParameter lensDirtThreshold = new ClampedFloatParameter(0.5f, 0, 1f); + + [LensAndLightingEffects, LensDirt, DisplayName("Dirt Texture")] + public TextureParameter lensDirtTexture = new TextureParameter(null); + + [LensAndLightingEffects, LensDirt, DisplayName("Spread")] + public ClampedIntParameter lensDirtSpread = new ClampedIntParameter(3, 3, 5); + + #endregion + + #region Chromatic Aberration + + [LensAndLightingEffects, ChromaticAberration, DisplayName("Intensity"), Min(0), ShowStrippedLabel] + public FloatParameter chromaticAberrationIntensity = new ClampedFloatParameter(0f, 0f, 0.1f); + + [LensAndLightingEffects, ChromaticAberration, DisplayName("Hue Shift"), Min(0), DisplayConditionBool("turboMode", false)] + public ClampedFloatParameter chromaticAberrationShift = new ClampedFloatParameter(0, -1, 1); + + [LensAndLightingEffects, ChromaticAberration, DisplayName("Smoothing"), DisplayConditionBool("turboMode", false)] + public FloatParameter chromaticAberrationSmoothing = new ClampedFloatParameter(0f, 0f, 32f); + + [LensAndLightingEffects, ChromaticAberration, DisplayName("Separate Pass")] + public BoolParameter chromaticAberrationSeparatePass = new BoolParameter(false); + + #endregion + + #region Depth of Field + + [LensAndLightingEffects, DepthOfField, DisplayName("Enable"), ToggleAllFields, DisplayConditionBool("ignoreDepthTexture", false), ShowStrippedLabel] + public BoolParameter depthOfField = new BoolParameter(false); + + [Header("Focus")] + [LensAndLightingEffects, DepthOfField, DisplayName("Focus Mode")] + public BeautifyDoFFocusModeParameter depthOfFieldFocusMode = new BeautifyDoFFocusModeParameter { value = DoFFocusMode.FixedDistance }; + + [LensAndLightingEffects, DepthOfField, DisplayName("Min Distance"), DisplayConditionEnum("depthOfFieldFocusMode", (int)DoFFocusMode.FixedDistance, isEqual: false)] + public FloatParameter depthOfFieldAutofocusMinDistance = new FloatParameter(0); + + [LensAndLightingEffects, DepthOfField, DisplayName("Max Distance"), DisplayConditionEnum("depthOfFieldFocusMode", (int)DoFFocusMode.FixedDistance, isEqual: false)] + public FloatParameter depthOfFieldAutofocusMaxDistance = new FloatParameter(10000); + + [LensAndLightingEffects, DepthOfField, DisplayName("Fallback"), Tooltip("Focus behaviour if object is not visible on the screen"), DisplayConditionEnum("depthOfFieldFocusMode", (int)DoFFocusMode.FollowTarget)] + public DoFTargetFallbackParameter depthOfFieldTargetFallback = new DoFTargetFallbackParameter { value = DoFTargetFallback.KeepCurrentFocalDistance }; + + [LensAndLightingEffects, DepthOfField, DisplayName("Distance"), DisplayConditionEnum("depthOfFieldTargetFallback", (int)DoFTargetFallback.FixedDistanceFocus)] + public FloatParameter depthOfFieldTargetFallbackFixedDistance = new FloatParameter(1000f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Viewport Point"), DisplayConditionEnum("depthOfFieldFocusMode", (int)DoFFocusMode.AutoFocus)] + public Vector2Parameter depthOfFieldAutofocusViewportPoint = new Vector2Parameter(new Vector2(0.5f, 0.5f)); + + [LensAndLightingEffects, DepthOfField, DisplayName("Distance Shift"), DisplayConditionEnum("depthOfFieldFocusMode", (int)DoFFocusMode.AutoFocus), Tooltip("Custom distance adjustment (positive or negative)")] + public FloatParameter depthOfFieldAutofocusDistanceShift = new FloatParameter(0); + + [LensAndLightingEffects, DepthOfField, DisplayName("Layer Mask"), DisplayConditionEnum("depthOfFieldFocusMode", (int)DoFFocusMode.AutoFocus)] + public BeautifyLayerMaskParameter depthOfFieldAutofocusLayerMask = new BeautifyLayerMaskParameter { value = -1 }; + + //public ClampedFloatParameter depthOfFieldTransparencySupportDownsampling = new ClampedFloatParameter(1f, 1f, 4f); + //public ClampedFloatParameter depthOfFieldExclusionBias = new ClampedFloatParameter(0.99f, 0.9f, 1f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Distance"), DisplayConditionEnum("depthOfFieldFocusMode", (int)DoFFocusMode.FixedDistance), Min(0)] + public FloatParameter depthOfFieldDistance = new FloatParameter(10f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Camera Lens Settings")] + public BeautifyDoFCameraSettingsParameter depthOfFieldCameraSettings = new BeautifyDoFCameraSettingsParameter { value = DoFCameraSettings.Classic }; + + [LensAndLightingEffects, DepthOfField, DisplayName("Focal Length"), DisplayConditionEnum("depthOfFieldCameraSettings", 0)] + public ClampedFloatParameter depthOfFieldFocalLength = new ClampedFloatParameter(0.050f, 0.005f, 0.5f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Aperture"), Min(0), DisplayConditionEnum("depthOfFieldCameraSettings", 0)] + public FloatParameter depthOfFieldAperture = new FloatParameter(2.8f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Focal Length"), DisplayConditionEnum("depthOfFieldCameraSettings", 1)] + [Tooltip("The distance between the lens center and the camera's sensor in mm.")] + public ClampedFloatParameter depthOfFieldFocalLengthReal = new ClampedFloatParameter(50, 1, 300); + + [LensAndLightingEffects, DepthOfField, DisplayName("F-Stop"), DisplayConditionEnum("depthOfFieldCameraSettings", 1)] + [Tooltip("The F-stop or F-number is the relation between the focal length and the diameter of the aperture")] + public ClampedFloatParameter depthOfFieldFStop = new ClampedFloatParameter(2, 1, 32); + + [LensAndLightingEffects, DepthOfField, DisplayName("Image Sensor Height"), DisplayConditionEnum("depthOfFieldCameraSettings", 1)] + [Tooltip("Represents the height of the virtual image sensor. By default, it uses a 24mm image sensor of a classic full-frame camera")] + public ClampedFloatParameter depthOfFieldImageSensorHeight = new ClampedFloatParameter(24, 1, 48); + + [LensAndLightingEffects, DepthOfField, DisplayName("Use Physical Camera Properties"), DisplayConditionEnum("depthOfFieldCameraSettings", 1)] + [Tooltip("When enabled, uses the focal length, f-stop and image sensor size from the current physical camera settings")] + public BoolParameter depthOfFieldUsePhysicalCamera = new BoolParameter(false); + + [LensAndLightingEffects, DepthOfField, DisplayName("Focus Speed")] + public ClampedFloatParameter depthOfFieldFocusSpeed = new ClampedFloatParameter(1f, 0.001f, 5f); + + [Header("Extra Features")] + + [LensAndLightingEffects, DepthOfField, DisplayName("Transparency Support"), ShowStrippedLabel] + public BoolParameter depthOfFieldTransparentSupport = new BoolParameter(false); + + [LensAndLightingEffects, DepthOfField, DisplayName("Layer Mask"), DisplayConditionBool("depthOfFieldTransparentSupport")] + public BeautifyLayerMaskParameter depthOfFieldTransparentLayerMask = new BeautifyLayerMaskParameter { value = 1 }; + + [LensAndLightingEffects, DepthOfField, DisplayName("Double Sided"), DisplayConditionBool("depthOfFieldTransparentSupport")] + [Tooltip("When enabled, transparent geometry is rendered with cull off.")] + public BoolParameter depthOfFieldTransparentDoubleSided = new BoolParameter(false); + + [LensAndLightingEffects, DepthOfField, DisplayName("Transparency Alpha Test Support"), ShowStrippedLabel] + [Tooltip("When enabled, transparent materials using alpha clipping will be included in the transparent mask")] + public BoolParameter depthOfFieldAlphaTestSupport = new BoolParameter(false); + + [LensAndLightingEffects, DepthOfField, DisplayName("Layer Mask"), DisplayConditionBool("depthOfFieldAlphaTestSupport")] + public BeautifyLayerMaskParameter depthOfFieldAlphaTestLayerMask = new BeautifyLayerMaskParameter { value = 1 }; + + [LensAndLightingEffects, DepthOfField, DisplayName("Double Sided"), DisplayConditionBool("depthOfFieldAlphaTestSupport")] + [Tooltip("When enabled, transparent geometry is rendered with cull off.")] + public BoolParameter depthOfFieldAlphaTestDoubleSided = new BoolParameter(false); + + [LensAndLightingEffects, DepthOfField, DisplayName("Foreground Blur")] + public BoolParameter depthOfFieldForegroundBlur = new BoolParameter(true); + + [LensAndLightingEffects, DepthOfField, DisplayName("Blur HQ"), DisplayConditionBool("depthOfFieldForegroundBlur")] + public BoolParameter depthOfFieldForegroundBlurHQ = new BoolParameter(false); + + [LensAndLightingEffects, DepthOfField, DisplayName("Blur Spread"), DisplayConditionBool("depthOfFieldForegroundBlurHQ")] + public ClampedFloatParameter depthOfFieldForegroundBlurHQSpread = new ClampedFloatParameter(4, 0, 32); + + [LensAndLightingEffects, DepthOfField, DisplayName("Distance"), DisplayConditionBool("depthOfFieldForegroundBlur")] + public FloatParameter depthOfFieldForegroundDistance = new FloatParameter(0.25f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Bokeh Effect")] + public BoolParameter depthOfFieldBokeh = new BoolParameter(true); + + [LensAndLightingEffects, DepthOfField, DisplayName("Composition"), DisplayConditionBool("depthOfFieldBokeh")] + [Tooltip("Specifies if the pass to compute bokeh is integrated (faster) or separated (stronger)")] + public BeautifyDoFBokehCompositionParameter depthOfFieldBokehComposition = new BeautifyDoFBokehCompositionParameter { value = DoFBokehComposition.Integrated }; + + [LensAndLightingEffects, DepthOfField, DisplayName("Threshold"), DisplayConditionBool("depthOfFieldBokeh")] + public ClampedFloatParameter depthOfFieldBokehThreshold = new ClampedFloatParameter(1f, 0f, 3f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Intensity"), DisplayConditionBool("depthOfFieldBokeh")] + public ClampedFloatParameter depthOfFieldBokehIntensity = new ClampedFloatParameter(2f, 0, 8f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Affects Bloom"), Tooltip("When enabled, bloom and anamorphic flares will be computed after depth of field is applied")] + public BoolParameter depthOfFieldAffectsBloom = new BoolParameter(false); + + + [Header("Quality")] + + [LensAndLightingEffects, DepthOfField, DisplayName("Downsampling")] + public ClampedIntParameter depthOfFieldDownsampling = new ClampedIntParameter(2, 1, 5); + + [LensAndLightingEffects, DepthOfField, DisplayName("Sample Count")] + public ClampedIntParameter depthOfFieldMaxSamples = new ClampedIntParameter(6, 2, 16); + + [LensAndLightingEffects, DepthOfField, DisplayName("Max Brightness")] + public FloatParameter depthOfFieldMaxBrightness = new FloatParameter(1000f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Max Blur Radius")] + public FloatParameter depthOfFieldMaxBlurRadius = new FloatParameter(1000f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Resolution Invariant"), Tooltip("Adjusts circle of confusion radius based on screen resolution.")] + public BoolParameter depthOfFieldResolutionInvariant = new BoolParameter(false); + + [LensAndLightingEffects, DepthOfField, DisplayName("Max Depth")] + public ClampedFloatParameter depthOfFieldMaxDistance = new ClampedFloatParameter(1f, 0, 1f); + + [LensAndLightingEffects, DepthOfField, DisplayName("Filter Mode")] + public BeautifyDoFFilterModeParameter depthOfFieldFilterMode = new BeautifyDoFFilterModeParameter { value = FilterMode.Bilinear }; + + #endregion + + #region Eye Adaptation + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Enable"), ToggleAllFields, ShowStrippedLabel] + public BoolParameter eyeAdaptation = new BoolParameter(false); + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Min Exposure")] + public ClampedFloatParameter eyeAdaptationMinExposure = new ClampedFloatParameter(0.2f, 0, 1); + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Max Exposure")] + public ClampedFloatParameter eyeAdaptationMaxExposure = new ClampedFloatParameter(5f, 1f, 100f); + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Light Adapt Speed"), Min(0)] + public FloatParameter eyeAdaptationSpeedToLight = new FloatParameter(0.4f); + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Dark Adapt Speed"), Min(0)] + public FloatParameter eyeAdaptationSpeedToDark = new FloatParameter(0.2f); + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Metering Mode")] + public BeautifyEyeAdaptationMeteringModeParameter eyeAdaptationMeteringMode = new BeautifyEyeAdaptationMeteringModeParameter { value = EyeAdaptationMeteringMode.FullFrame }; + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Mask (A)"), Tooltip("When assigned, eye adaptation will be applied only to the pixels within the mask (red channel)"), DisplayConditionEnum("eyeAdaptationMeteringMode", (int)EyeAdaptationMeteringMode.Mask)] + public TextureParameter eyeAdaptationMask = new TextureParameter(null); + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Center Weight"), Tooltip("Controls the strength of center-weighted metering (if no mask is used). 0 = uniform, higher values bias metering toward the screen center."), DisplayConditionEnum("eyeAdaptationMeteringMode", (int)EyeAdaptationMeteringMode.FullFrame)] + public ClampedFloatParameter eyeAdaptationCenterWeight = new ClampedFloatParameter(1f, 0f, 8f); + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Metering Min Distance"), Tooltip("Minimum object depth in meters to consider for eye adaptation")] + public FloatParameter eyeAdaptationMinCameraDistance = new FloatParameter(0f); + + [LensAndLightingEffects, EyeAdaptation, DisplayName("Middle Gray"), Tooltip("The 'neutral' brightness your auto‑exposure targets or roughly how bright an average surface should look. Lower values make scenes appear darker; higher values make them appear brighter.")] + public ClampedFloatParameter eyeAdaptationMiddleGray = new ClampedFloatParameter(0.18f, 0.001f, 0.5f); + + #endregion + + #region Purkinje effect + + [LensAndLightingEffects, PurkinjeShift, DisplayName("Enable"), ToggleAllFields, ShowStrippedLabel] + public BoolParameter purkinje = new BoolParameter(false); + + [LensAndLightingEffects, PurkinjeShift, DisplayName("Shift Amount")] + public ClampedFloatParameter purkinjeAmount = new ClampedFloatParameter(1f, 0f, 5f); + + [LensAndLightingEffects, PurkinjeShift, DisplayName("Threshold")] + public ClampedFloatParameter purkinjeLuminanceThreshold = new ClampedFloatParameter(0.15f, 0f, 1f); + + #endregion + + #region Vignetting + + [ArtisticChoices, Vignette, DisplayName("Outer Ring"), ShowStrippedLabel] + public ClampedFloatParameter vignettingOuterRing = new ClampedFloatParameter(0f, -2f, 1f); + + [ArtisticChoices, Vignette, DisplayName("Inner Ring")] + public ClampedFloatParameter vignettingInnerRing = new ClampedFloatParameter(0, 0, 1f); + + [ArtisticChoices, Vignette, DisplayName("Fade")] + public ClampedFloatParameter vignettingFade = new ClampedFloatParameter(0, 0, 1f); + + [ArtisticChoices, Vignette, DisplayName("Circular Shape")] + public BoolParameter vignettingCircularShape = new BoolParameter(false); + + [ArtisticChoices, Vignette, DisplayName("Fit Mode"), DisplayConditionBool("vignettingCircularShape")] + public BeautifyVignetteFitModeParameter vignettingCircularShapeFitMode = new BeautifyVignetteFitModeParameter { value = VignetteFitMode.FitToWidth }; + + [ArtisticChoices, Vignette, DisplayName("Aspect Ratio"), DisplayConditionBool("vignettingCircularShape", false)] + public ClampedFloatParameter vignettingAspectRatio = new ClampedFloatParameter(1f, 0, 1f); + + [ArtisticChoices, Vignette, DisplayName("Blink")] + public ClampedFloatParameter vignettingBlink = new ClampedFloatParameter(0f, 0, 1); + + [ArtisticChoices, Vignette, DisplayName("Blink Style")] + public BeautifyBlinkStyleParameter vignettingBlinkStyle = new BeautifyBlinkStyleParameter { value = BlinkStyle.Cutscene }; + + [ArtisticChoices, Vignette, DisplayName("Center")] + public Vector2Parameter vignettingCenter = new Vector2Parameter(new Vector2(0.5f, 0.5f)); + + [ArtisticChoices, Vignette, DisplayName("Tint Color")] + public ColorParameter vignettingColor = new ColorParameter(new Color(0f, 0f, 0f, 1f)); + + [ArtisticChoices, Vignette, DisplayName("Texture Mask"), ShowStrippedLabel] + public TextureParameter vignettingMask = new TextureParameter(null); + + #endregion + + #region Outline + + [Serializable] + public sealed class BeautifyOutlineStageParameter : VolumeParameter { } + + [Serializable] + public sealed class BeautifyOutlineTechniqueParameter : VolumeParameter { } + + [ArtisticChoices, Outline, DisplayConditionBool("ignoreDepthTexture", false), ShowStrippedLabel] + public BoolParameter outline = new BoolParameter(false); + + [ArtisticChoices, Outline, DisplayName("Color")] + public ColorParameter outlineColor = new ColorParameter(value: new Color(0, 0, 0, 0.8f), hdr: true, showAlpha: false, showEyeDropper: true); + + [ArtisticChoices, Outline, DisplayName("Technique"), Tooltip("Depth: uses scene depth to find edges. Per Object Id: performs a custom pre-pass which renders meshes id to identify independent objects.")] + public BeautifyOutlineTechniqueParameter outlineTechnique = new BeautifyOutlineTechniqueParameter { value = OutlineTechnique.Depth }; + + [ArtisticChoices, Outline, DisplayName("Minimum Separation"), DisplayConditionEnum("outlineTechnique", (int)OutlineTechnique.PerObjectId)] + public ClampedIntParameter outlineMinSeparation = new ClampedIntParameter(1, 1, 5); + + [ArtisticChoices, Outline, DisplayName("Outer Only"), DisplayConditionEnum("outlineTechnique", (int)OutlineTechnique.PerObjectId)] + public BoolParameter outlineOuterOnly = new BoolParameter(false); + + [ArtisticChoices, Outline, DisplayName("Edge Threshold"), DisplayConditionEnum("outlineTechnique", (int)OutlineTechnique.Depth)] + public ClampedFloatParameter outlineThreshold = new ClampedFloatParameter(0.2f, 0f, 0.5f); + + [ArtisticChoices, Outline, DisplayName("Depth Diff Threshold"), DisplayConditionEnum("outlineTechnique", (int)OutlineTechnique.Depth)] + public ClampedFloatParameter outlineMinDepthThreshold = new ClampedFloatParameter(0.0005f, 0f, 0.01f); + + [ArtisticChoices, Outline, DisplayName("Saturation Diff Threshold"), DisplayConditionEnum("outlineTechnique", (int)OutlineTechnique.Depth)] + public ClampedFloatParameter outlineSaturationDiffThreshold = new ClampedFloatParameter(0.015f, 0f, 0.5f); + + [ArtisticChoices, Outline, DisplayName("Customize")] + public BoolParameter outlineCustomize = new BoolParameter(false); + + [ArtisticChoices, Outline, DisplayName("Layer Mask"), DisplayConditionBool("outlineCustomize"), Tooltip("Optionally specify which objects should receive the outline effect")] + public LayerMaskParameter outlineLayerMask = new LayerMaskParameter(-1); + + [ArtisticChoices, Outline, DisplayName("Render Stage"), DisplayConditionBool("outlineCustomize")] + public BeautifyOutlineStageParameter outlineStageParameter = new BeautifyOutlineStageParameter { value = OutlineStage.BeforeBloom }; + + [ArtisticChoices, Outline, DisplayName("Spread"), DisplayConditionBool("outlineCustomize")] + public ClampedFloatParameter outlineSpread = new ClampedFloatParameter(1f, 0, 1.3f); + + [ArtisticChoices, Outline, DisplayName("Blur Count"), DisplayConditionBool("outlineCustomize")] + public ClampedIntParameter outlineBlurPassCount = new ClampedIntParameter(1, 1, 5); + + [ArtisticChoices, Outline, DisplayName("Downscale Blur"), DisplayConditionBool("outlineCustomize")] + public BoolParameter outlineBlurDownscale = new BoolParameter(false); + + [ArtisticChoices, Outline, DisplayName("Intensity Multiplier"), DisplayConditionBool("outlineCustomize")] + public ClampedFloatParameter outlineIntensityMultiplier = new ClampedFloatParameter(1, 0, 8); + + [Tooltip("Maximum distance in meters from the camera")] + [ArtisticChoices, Outline, DisplayName("Distance Fade"), DisplayConditionBool("outlineCustomize")] + public FloatParameter outlineDistanceFade = new FloatParameter(0); + + [ArtisticChoices, Outline, DisplayName("Use Optimized Shader"), DisplayConditionBool("outlineCustomize"), Tooltip("Uses a depth-only custom shader which should be faster. This option is only used when outline technique is set to Depth. If the scene uses shaders that transform the vertices coordinates, you may want to disable this option.")] + public BoolParameter outlineUsesOptimizedShader = new BoolParameter(false); + +#if UNITY_2022_3_OR_NEWER + [ArtisticChoices, Outline, DisplayName("Cut Off"), DisplayConditionBool("outlineUsesOptimizedShader"), Tooltip("Optionally set the alpha test/cut off. Only applies if optimized shader is used.")] + public ClampedFloatParameter outlineLayerCutOff = new ClampedFloatParameter(0f, 0, 1); +#endif + + + #endregion + + #region Night Vision + + [ArtisticChoices, NightVision, DisplayName("Enable"), ShowStrippedLabel] + public BoolParameter nightVision = new BoolParameter(false); + + [ArtisticChoices, NightVision, DisplayName("Scan Lines Color")] + public ColorParameter nightVisionColor = new ColorParameter(new Color(0.5f, 1f, 0.5f, 0.5f)); + + [ArtisticChoices, NightVision, DisplayName("Max Visible Depth")] + public FloatParameter nightVisionDepth = new FloatParameter(100000); + + [ArtisticChoices, NightVision, DisplayName("Max Visible Depth Fall Off")] + public ClampedFloatParameter nightVisionDepthFallOff = new ClampedFloatParameter(1, 0.01f, 10); + + #endregion + + #region Thermal Vision + + [ArtisticChoices, ThermalVision, DisplayName("Enable"), ShowStrippedLabel] + public BoolParameter thermalVision = new BoolParameter(false); + + [ArtisticChoices, ThermalVision, DisplayName("Scan Lines")] + public BoolParameter thermalVisionScanLines = new BoolParameter(true); + + [ArtisticChoices, ThermalVision, DisplayName("Distortion Amount")] + public ClampedFloatParameter thermalVisionDistortionAmount = new ClampedFloatParameter(9f, 0, 100f); + + #endregion + + #region RGB Dither + + [ImageEnhancement, Dither, DisplayName("Intensity"), ShowStrippedLabel] + public ClampedFloatParameter ditherIntensity = new ClampedFloatParameter(0.0f, 0, 0.02f); + + #endregion + + #region Frame + + public enum FrameStyle { + Border, + CinematicBands + } + + [Serializable] + public sealed class BeautifyFrameStyleParameter : VolumeParameter { } + + [ArtisticChoices, Frame, DisplayName("Enable"), ToggleAllFields, ShowStrippedLabel] + public BoolParameter frame = new BoolParameter(false); + + [ArtisticChoices, Frame, DisplayName("Style")] + public BeautifyFrameStyleParameter frameStyle = new BeautifyFrameStyleParameter { value = FrameStyle.Border }; + + [ArtisticChoices, Frame, DisplayName("Horizontal Bands Size"), DisplayConditionEnum("frameStyle", (int)FrameStyle.CinematicBands)] + public ClampedFloatParameter frameBandHorizontalSize = new ClampedFloatParameter(0, 0, 0.5f); + + [ArtisticChoices, Frame, DisplayName("Horizontal Bands Smoothness"), DisplayConditionEnum("frameStyle", (int)FrameStyle.CinematicBands)] + public ClampedFloatParameter frameBandHorizontalSmoothness = new ClampedFloatParameter(0, 0, 1); + + [ArtisticChoices, Frame, DisplayName("Vertical Bands Size"), DisplayConditionEnum("frameStyle", (int)FrameStyle.CinematicBands)] + public ClampedFloatParameter frameBandVerticalSize = new ClampedFloatParameter(0.1f, 0, 0.5f); + + [ArtisticChoices, Frame, DisplayName("Vertical Bands Smoothness"), DisplayConditionEnum("frameStyle", (int)FrameStyle.CinematicBands)] + public ClampedFloatParameter frameBandVerticalSmoothness = new ClampedFloatParameter(0, 0, 1); + + [ArtisticChoices, Frame, DisplayName("Color"), DisplayConditionEnum("frameStyle", (int)FrameStyle.Border)] + public ColorParameter frameColor = new ColorParameter(new Color(1, 1, 1, 1)); + + [ArtisticChoices, Frame, DisplayName("Thickness"), DisplayConditionEnum("frameStyle", (int)FrameStyle.Border)] + public ClampedFloatParameter frameThickness = new ClampedFloatParameter(0.047f, 0, 1); + + [ArtisticChoices, Frame, DisplayName("Sharpness"), DisplayConditionEnum("frameStyle", (int)FrameStyle.Border)] + public ClampedFloatParameter frameSharpness = new ClampedFloatParameter(50f, 1f, 255f); + + [ArtisticChoices, Frame, DisplayName("Texture Mask"), ShowStrippedLabel] + public TextureParameter frameMask = new TextureParameter(null); + + + + #endregion + + #region Film Grain + + [ArtisticChoices, FilmGrainAndArtifacts, DisplayName("Enable"), ToggleAllFields, ShowStrippedLabel] + public BoolParameter filmGrainEnabled = new BoolParameter(false); + + [ArtisticChoices, FilmGrainAndArtifacts, DisplayName("Grain Intensity")] + public ClampedFloatParameter filmGrainIntensity = new ClampedFloatParameter(0, 0, 1); + + [ArtisticChoices, FilmGrainAndArtifacts, DisplayName("Resolution")] + public ClampedFloatParameter filmGrainResolution = new ClampedFloatParameter(0.85f, 0.001f, 1f); + + [ArtisticChoices, FilmGrainAndArtifacts, DisplayName("Luma Attenuation"), Tooltip("Controls how much grain is visible on bright areas. 0 for equally noise on all areas, 1 for reduced noise on bright areas.")] + public ClampedFloatParameter filmGrainLumaAttenuation = new ClampedFloatParameter(0.8f, 0, 1f); + + [ArtisticChoices, FilmGrainAndArtifacts, DisplayName("Dirt Spots Amount"), Tooltip("Controls the frequency of dirt spots appearing on the film."), DisplayConditionBool("turboMode", false)] + public ClampedFloatParameter filmGrainDirtSpotsAmount = new ClampedFloatParameter(0.0f, 0, 1f); + + [ArtisticChoices, FilmGrainAndArtifacts, DisplayName("Dirt Spots Intensity"), Tooltip("Controls the visibility/brightness of dirt spots."), DisplayConditionBool("turboMode", false)] + public ClampedFloatParameter filmGrainDirtSpotsIntensity = new ClampedFloatParameter(0.2f, 0, 1f); + + [ArtisticChoices, FilmGrainAndArtifacts, DisplayName("Scratches Amount"), Tooltip("Controls the frequency of scratches appearing on the film."), DisplayConditionBool("turboMode", false)] + public ClampedFloatParameter filmGrainScratchesAmount = new ClampedFloatParameter(0.0f, 0, 1f); + + [ArtisticChoices, FilmGrainAndArtifacts, DisplayName("Scratches Intensity"), Tooltip("Controls the visibility/brightness of scratches."), DisplayConditionBool("turboMode", false)] + public ClampedFloatParameter filmGrainScratchesIntensity = new ClampedFloatParameter(0.3f, 0, 1f); + + #endregion + + #region Final Blur + + [ArtisticChoices, FinalBlur, DisplayName("Intensity")] + public ClampedFloatParameter blurIntensity = new ClampedFloatParameter(0f, 0f, 64f); + + [ArtisticChoices, FinalBlur, DisplayName("Mask")] + public TextureParameter blurMask = new TextureParameter(null); + + [ArtisticChoices, FinalBlur, DisplayName("Keep Source On Top")] + public BoolParameter blurKeepSourceOnTop = new BoolParameter(false); + + [ArtisticChoices, FinalBlur, DisplayName("Rect"), DisplayConditionBool("blurKeepSourceOnTop")] + public Vector4Parameter blurSourceRect = new Vector4Parameter(new Vector4(0.1f, 0.1f, 0.8f, 0.8f)); + + [ArtisticChoices, FinalBlur, DisplayName("Edge Blending Width"), DisplayConditionBool("blurKeepSourceOnTop")] + public ClampedFloatParameter blurSourceEdgeBlendWidth = new ClampedFloatParameter(0, 0, 1); + + [ArtisticChoices, FinalBlur, DisplayName("Edge Blending Strength"), DisplayConditionBool("blurKeepSourceOnTop")] + public FloatParameter blurSourceEdgeBlendStrength = new FloatParameter(20); + + #endregion + + public bool IsActive() => !disabled.value; + + public bool IsTileCompatible() => true; + + public bool RequiresDepthTexture() { + return sharpenIntensity.value > 0 || antialiasStrength.value > 0 || depthOfField.value || bloomDepthAtten.value > 0 || bloomNearAtten.value > 0 || anamorphicFlaresDepthAtten.value > 0 || anamorphicFlaresNearAtten.value > 0 || sunFlaresIntensity.value > 0 || outline.value; + } + + int downsamplingUsed; + + + void OnValidate() { + bloomIntensity.value = Mathf.Max(bloomIntensity.value, 0); + bloomDepthAtten.value = Mathf.Max(bloomDepthAtten.value, 0); + bloomNearAtten.value = Mathf.Max(bloomNearAtten.value, 0); + bloomThreshold.value = Mathf.Max(bloomThreshold.value, 0); + anamorphicFlaresIntensity.value = Mathf.Max(anamorphicFlaresIntensity.value, 0); + anamorphicFlaresDepthAtten.value = Mathf.Max(anamorphicFlaresDepthAtten.value, 0); + anamorphicFlaresNearAtten.value = Mathf.Max(anamorphicFlaresNearAtten.value, 0); + anamorphicFlaresThreshold.value = Mathf.Max(anamorphicFlaresThreshold.value, 0); + depthOfFieldDistance.value = Mathf.Max(depthOfFieldDistance.value, depthOfFieldFocalLength.value); + outlineDistanceFade.value = Mathf.Max(outlineDistanceFade.value, 0); + antialiasDepthAttenuation.value = Mathf.Max(antialiasDepthAttenuation.value, 0); + nightVisionDepth.value = Mathf.Max(0, nightVisionDepth.value); + depthOfFieldMaxBlurRadius.value = Mathf.Max(0, depthOfFieldMaxBlurRadius.value); + tonemapMaxInputBrightness.value = Mathf.Max(0, tonemapMaxInputBrightness.value); + eyeAdaptationMinCameraDistance.value = Mathf.Max(0, eyeAdaptationMinCameraDistance.value); + + if (!downsampling.value && downsamplingUsed == 1) { + // deactivate downsampling on the pipeline + UniversalRenderPipelineAsset pipe = (UniversalRenderPipelineAsset)GraphicsSettings.currentRenderPipeline; + pipe.renderScale = 1f; + } + downsamplingUsed = downsampling.value ? 1 : -1; + blurSourceEdgeBlendStrength.value = Mathf.Max(blurSourceEdgeBlendStrength.value, 0); + + } + + + } +} diff --git a/Assets/External/Beautify/URP/Runtime/Beautify.cs.meta b/Assets/External/Beautify/URP/Runtime/Beautify.cs.meta new file mode 100644 index 00000000..b8f878a9 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Beautify.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c133717c76e564a5fa90d7f12908d17e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/BeautifyAsmRef.asmref b/Assets/External/Beautify/URP/Runtime/BeautifyAsmRef.asmref new file mode 100644 index 00000000..cb3b0b05 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/BeautifyAsmRef.asmref @@ -0,0 +1,3 @@ +{ + "reference": "GUID:15fc0a57446b3144c949da3e2b9737a9" +} \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/BeautifyAsmRef.asmref.meta b/Assets/External/Beautify/URP/Runtime/BeautifyAsmRef.asmref.meta new file mode 100644 index 00000000..535746fc --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/BeautifyAsmRef.asmref.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a150e8e335e554cae8e97ed470edd5ca +AssemblyDefinitionReferenceImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/BeautifyRendererFeature.cs b/Assets/External/Beautify/URP/Runtime/BeautifyRendererFeature.cs new file mode 100644 index 00000000..11fe92dc --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/BeautifyRendererFeature.cs @@ -0,0 +1,3374 @@ +using System; +using System.Collections.Generic; +#if UNITY_EDITOR +using System.Reflection; +using UnityEditor.Build.Reporting; + +#endif +using UnityEngine; +using UnityEngine.Rendering; +#if UNITY_2023_3_OR_NEWER +using UnityEngine.Rendering.RenderGraphModule; +#endif +using UnityEngine.Rendering.Universal; +using static Beautify.Universal.Beautify; + +namespace Beautify.Universal { + + public static class ShaderParams { + public static int mainTex = Shader.PropertyToID("_MainTex"); + public static int inputTex = Shader.PropertyToID("_BeautifyInputTex"); + public static int blueNoiseTex = Shader.PropertyToID("_BlueNoise"); + + public static int sharpen = Shader.PropertyToID("_Sharpen"); + public static int colorParams = Shader.PropertyToID("_Params"); + public static int colorBoost = Shader.PropertyToID("_ColorBoost"); + public static int tintColor = Shader.PropertyToID("_TintColor"); + public static int compareTex = Shader.PropertyToID("_CompareTex"); + public static int compareParams = Shader.PropertyToID("_CompareParams"); + public static int fxColor = Shader.PropertyToID("_FXColor"); + public static int lutTex = Shader.PropertyToID("_LUTTex"); + public static int lut3DTexture = Shader.PropertyToID("_LUT3DTex"); + public static int lut3DParams = Shader.PropertyToID("_LUT3DParams"); + public static int colorTemp = Shader.PropertyToID("_ColorTemp"); + public static int flipY = Shader.PropertyToID("_FlipY"); + public static int tonemapAGXGamma = Shader.PropertyToID("_TonemapAGXGamma"); + + public static int blurScale = Shader.PropertyToID("_BlurScale"); + public static int tempBlurRT = Shader.PropertyToID("_BeautifyTempBlurRT"); + public static int tempBloomCustomComposeRT = Shader.PropertyToID("_BeautifyTempBloomCustomComposeRT"); + public static int tempBloomCustomComposeRTOriginal = Shader.PropertyToID("_BeautifyTempBloomCustomComposeRT"); + public static int tempBlurOneDirRT = Shader.PropertyToID("_BeautifyTempBlurOneDir0"); + public static int tempBlurOneDirRTOriginal = Shader.PropertyToID("_BeautifyTempBlurOneDir0"); + public static int tempBlurDownscaling = Shader.PropertyToID("_BeautifyTempBlurDownscaling"); + + public static int bloom = Shader.PropertyToID("_Bloom"); + public static int bloomWeights = Shader.PropertyToID("_BloomWeights"); + public static int bloomWeights2 = Shader.PropertyToID("_BloomWeights2"); + public static int bloomDepthThreshold = Shader.PropertyToID("_BloomDepthThreshold"); + public static int bloomNearThreshold = Shader.PropertyToID("_BloomNearThreshold"); + public static int bloomTex = Shader.PropertyToID("_BloomTex"); + public static int bloomTex1 = Shader.PropertyToID("_BloomTex1"); + public static int bloomTex2 = Shader.PropertyToID("_BloomTex2"); + public static int bloomTex3 = Shader.PropertyToID("_BloomTex3"); + public static int bloomTex4 = Shader.PropertyToID("_BloomTex4"); + public static int bloomTint = Shader.PropertyToID("_BloomTint"); + public static int bloomTint0 = Shader.PropertyToID("_BloomTint0"); + public static int bloomTint1 = Shader.PropertyToID("_BloomTint1"); + public static int bloomTint2 = Shader.PropertyToID("_BloomTint2"); + public static int bloomTint3 = Shader.PropertyToID("_BloomTint3"); + public static int bloomTint4 = Shader.PropertyToID("_BloomTint4"); + public static int bloomTint5 = Shader.PropertyToID("_BloomTint5"); + public static int bloomSpread = Shader.PropertyToID("_BloomSpread"); + public static int bloomExclusionZBias = Shader.PropertyToID("_BloomLayerZBias"); + + public static int dirt = Shader.PropertyToID("_Dirt"); + public static int dirtTex = Shader.PropertyToID("_OverlayTex"); + public static int screenLum = Shader.PropertyToID("_ScreenLum"); + + public static int afData = Shader.PropertyToID("_AFData"); + public static int afDepthThreshold = Shader.PropertyToID("_AFDepthThreshold"); + public static int afNearThreshold = Shader.PropertyToID("_AFNearThreshold"); + public static int afTintColor = Shader.PropertyToID("_AFTint"); + public static int afCombineTex = Shader.PropertyToID("_CombineTex"); + + public static int sfSunData = Shader.PropertyToID("_SunData"); + public static int sfSunPos = Shader.PropertyToID("_SunPos"); + public static int sfSunDir = Shader.PropertyToID("_SunDir"); + public static int sfSunTintColor = Shader.PropertyToID("_SunTint"); + public static int sfOcclusionThreshold = Shader.PropertyToID("_SunOcclusionThreshold"); + public static int sfCoronaRays1 = Shader.PropertyToID("_SunCoronaRays1"); + public static int sfCoronaRays2 = Shader.PropertyToID("_SunCoronaRays2"); + public static int sfGhosts1 = Shader.PropertyToID("_SunGhosts1"); + public static int sfGhosts2 = Shader.PropertyToID("_SunGhosts2"); + public static int sfGhosts3 = Shader.PropertyToID("_SunGhosts3"); + public static int sfGhosts4 = Shader.PropertyToID("_SunGhosts4"); + public static int sfHalo = Shader.PropertyToID("_SunHalo"); + public static int sfRT = Shader.PropertyToID("_BeautifyTempSF0"); + public static int sfFlareTex = Shader.PropertyToID("_FlareTex"); + public static int sfAspectRatio = Shader.PropertyToID("_SunFlaresAspectRatio"); + public static int sfOcclusionTex = Shader.PropertyToID("_OcclusionTex"); + + public static int dofRT = Shader.PropertyToID("_DoFTex"); + public static int dofTempBlurDoFAlphaRT = Shader.PropertyToID("_BeautifyTempBlurAlphaDoF"); + public static int dofTempBlurDoFTemp1RT = Shader.PropertyToID("_BeautifyTempBlurPass1DoF"); + public static int dofTempBlurDoFTemp2RT = Shader.PropertyToID("_BeautifyTempBlurPass2DoF"); + public static int dofBokehData = Shader.PropertyToID("_BokehData"); + public static int dofBokehData2 = Shader.PropertyToID("_BokehData2"); + public static int dofBokehData3 = Shader.PropertyToID("_BokehData3"); + public static int dofBokehRT = Shader.PropertyToID("_DofBokeh"); + + public static int vignette = Shader.PropertyToID("_Vignetting"); + public static int vignetteData = Shader.PropertyToID("_VignettingData"); + public static int vignetteData2 = Shader.PropertyToID("_VignettingData2"); + public static int vignetteMask = Shader.PropertyToID("_VignettingMask"); + + public static int purkinje = Shader.PropertyToID("_Purkinje"); + + public static int eaLumSrc = Shader.PropertyToID("_EALumSrc"); + public static int eaHist = Shader.PropertyToID("_EAHist"); + public static int eaParams = Shader.PropertyToID("_EyeAdaptation"); + public static int eaParams2 = Shader.PropertyToID("_EyeAdaptation2"); + public static int eaMinCameraDistance = Shader.PropertyToID("_EyeAdaptationMinCameraDistance"); + public static int eaMask = Shader.PropertyToID("_EAMask"); + public static int outline = Shader.PropertyToID("_Outline"); + public static int outlineData = Shader.PropertyToID("_OutlineData"); + public static int outlineRT = Shader.PropertyToID("_OutlineRT"); + + public static int blurRT = Shader.PropertyToID("_BlurTex"); + public static int blurMaskedRT = Shader.PropertyToID("_BlurMaskedTex"); + public static int blurMask = Shader.PropertyToID("_BlurMask"); + + public static int nightVision = Shader.PropertyToID("_NightVision"); + public static int nightVisionDepth = Shader.PropertyToID("_NightVisionDepth"); + + public static int chromaticAberrationData = Shader.PropertyToID("_ChromaticAberrationData"); + public static int chromaticTempTex = Shader.PropertyToID("_ChromaticTex"); + + public static int lutPreview = Shader.PropertyToID("_LUTPreview"); + + public static int frameColor = Shader.PropertyToID("_Frame"); + public static int frameMask = Shader.PropertyToID("_FrameMask"); + public static int frameData = Shader.PropertyToID("_FrameData"); + + public static int CustomDepthAlphaCutoff = Shader.PropertyToID("_Cutoff"); + public static int CustomDepthAlphaTestCutoff = Shader.PropertyToID("_OutlineCutOff"); + public static int CustomDepthBaseMap = Shader.PropertyToID("_BaseMap"); + + public static int edgeAntialiasing = Shader.PropertyToID("_AntialiasData"); + + public static int miniViewTex = Shader.PropertyToID("_MiniViewTex"); + public static int miniViewRect = Shader.PropertyToID("_MiniViewRect"); + public static int miniViewBlend = Shader.PropertyToID("_MiniViewBlend"); + + public static int filmGrainData = Shader.PropertyToID("_FilmGrainData"); + public static int filmArtifactsData = Shader.PropertyToID("_FilmArtifactsData"); + + public const string SKW_SHARPEN = "BEAUTIFY_SHARPEN"; + public const string SKW_SHARPEN_EXCLUSION_MASK = "BEAUTIFY_EXCLUSION_MASK_SHARPEN"; + public const string SKW_TONEMAP_ACES = "BEAUTIFY_ACES_TONEMAP"; + public const string SKW_TONEMAP_ACES_FITTED = "BEAUTIFY_ACES_FITTED_TONEMAP"; + public const string SKW_TONEMAP_AGX = "BEAUTIFY_AGX_TONEMAP"; + public const string SKW_LUT = "BEAUTIFY_LUT"; + public const string SKW_LUT3D = "BEAUTIFY_3DLUT"; + public const string SKW_BLOOM = "BEAUTIFY_BLOOM"; + public const string SKW_BLOOM_USE_DEPTH = "BEAUTIFY_BLOOM_USE_DEPTH"; + public const string SKW_BLOOM_USE_LAYER = "BEAUTIFY_BLOOM_USE_LAYER"; + public const string SKW_BLOOM_USE_LAYER_INCLUSION = "BEAUTIFY_BLOOM_USE_LAYER_INCLUSION"; + public const string SKW_BLOOM_PROP_THRESHOLDING = "BEAUTIFY_BLOOM_PROP_THRESHOLDING"; + public const string SKW_DIRT = "BEAUTIFY_DIRT"; + public const string SKW_ANAMORPHIC_FLARES_USE_DEPTH = "BEAUTIFY_ANAMORPHIC_FLARES_USE_DEPTH"; + public const string SKW_ANAMORPHIC_FLARES_USE_LAYER = "BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER"; + public const string SKW_ANAMORPHIC_FLARES_USE_LAYER_INCLUSION = "BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER_INCLUSION"; + public const string SKW_ANAMORPHIC_PROP_THRESHOLDING = "BEAUTIFY_ANAMORPHIC_PROP_THRESHOLDING"; + public const string SKW_EA_USE_DEPTH = "BEAUTIFY_EA_USE_DEPTH"; + public const string SKW_EA_USE_MASK = "BEAUTIFY_EA_USE_MASK"; + public const string SKW_DEPTH_OF_FIELD = "BEAUTIFY_DEPTH_OF_FIELD"; + public const string SKW_DEPTH_OF_FIELD_TRANSPARENT = "BEAUTIFY_DOF_TRANSPARENT"; + public const string SKW_VIGNETTING = "BEAUTIFY_VIGNETTING"; + public const string SKW_VIGNETTING_MASK = "BEAUTIFY_VIGNET_MASK"; + public const string SKW_PURKINJE = "BEAUTIFY_PURKINJE"; + public const string SKW_EYE_ADAPTATION = "BEAUTIFY_EYE_ADAPTATION"; + public const string SKW_OUTLINE = "BEAUTIFY_OUTLINE"; + public const string SKW_OUTLINE_DEPTH_FADE = "BEAUTIFY_DEPTH_FADE"; + public const string SKW_TURBO = "BEAUTIFY_TURBO"; + public const string SKW_COLOR_TWEAKS = "BEAUTIFY_COLOR_TWEAKS"; + public const string SKW_NIGHT_VISION = "BEAUTIFY_NIGHT_VISION"; + public const string SKW_THERMAL_VISION = "BEAUTIFY_THERMAL_VISION"; + public const string SKW_DITHER = "BEAUTIFY_DITHER"; + public const string SKW_CHROMATIC_ABERRATION = "BEAUTIFY_CABERRATION"; + public const string SKW_FRAME = "BEAUTIFY_FRAME"; + public const string SKW_FILM_GRAIN = "BEAUTIFY_FILM_GRAIN"; + public const string SKW_SUN_FLARES_USE_GHOSTS = "BEAUTIFY_SF_USE_GHOSTS"; + public const string SKW_SUN_FLARES_OCCLUSION_INIT = "BEAUTIFY_SF_OCCLUSION_INIT"; + public const string SKW_SUN_FLARES_OCCLUSION_SIMPLE = "BEAUTIFY_SF_OCCLUSION_SIMPLE"; + public const string SKW_SUN_FLARES_OCCLUSION_SMOOTH = "BEAUTIFY_SF_OCCLUSION_SMOOTH"; + public const string SKW_CUSTOM_DEPTH_ALPHA_TEST = "DEPTH_PREPASS_ALPHA_TEST"; + public const string SKW_EDGE_ANTIALIASING = "BEAUTIFY_EDGE_AA"; + public const string SKW_OUTLINE_CUSTOM_DEPTH = "BEAUTIFY_OUTLINE_CUSTOM_DEPTH"; + public const string SKW_OUTLINE_OBJECT_ID = "BEAUTIFY_OUTLINE_OBJECT_ID"; + public const string SKW_OUTLINE_MIN_SEPARATION = "BEAUTIFY_OUTLINE_MIN_SEPARATION"; + public const string SKW_OUTLINE_OUTER_ONLY = "BEAUTIFY_OUTLINE_OUTER_ONLY"; + } + + public class BeautifyRendererFeature : ScriptableRendererFeature { + + class PassData { + public Camera camera; + public CommandBuffer cmd; +#if UNITY_2023_3_OR_NEWER + public TextureHandle colorTexture; +#endif + } + + class BeautifyRenderPass : ScriptableRenderPass { + + enum Pass { + CopyExact = 0, + Compare = 1, + Beautify = 2, + BloomLuminance = 3, + BloomDebug = 4, + BlurHoriz = 5, + BlurVert = 6, + BloomCompose = 7, + BloomResample = 8, + BloomResampleAndCombine = 9, + BloomLuminanceAntiflicker = 10, + AnamorphicFlaresResample = 11, + AnamorphicFlaresResampleAndCombine = 12, + ComputeScreenLum = 13, + DownsampleScreenLum = 14, + BlendScreenLum = 15, + SimpleBlendLum = 16, + AnamorphicFlaresLuminance = 17, + AnamorphicFlaresLuminanceAntiflicker = 18, + SunFlares = 19, + SunFlaresAdditive = 20, + DoFCoC = 21, + DoFCoCDebug = 22, + DoFBlur = 23, + DoFBlurWithoutBokeh = 24, + DoFBlurHorizontally = 25, + DoFBlurVertically = 26, + CopyBilinear = 27, + BloomExclusionLayerDebug = 28, + DoFDebugTransparent = 29, + ChromaticAberration = 30, + OutlineDetect = 31, + OutlineBlurH = 32, + OutlineBlurV = 33, + OutlineBlend = 34, + BlurMask = 35, + DoFBokeh = 36, + DoFAdditive = 37, + DoFBlurBokeh = 38, + AnamorphicFlaresExclusionLayerDebug = 39, + CopyWithMiniView = 40, + SunFlaresOcclusionTest = 41 + } + + struct BloomMipData { + public int rtDown, rtUp, width, height; + public int rtDownOriginal, rtUpOriginal; + } + + const int PYRAMID_COUNT_BLOOM = 5; + const int PYRAMID_COUNT_BLOOM_TURBO = 3; + const int PYRAMID_COUNT_EA = 9; + + readonly PassData passData = new PassData(); + + static readonly List keywords = new List(); + static string[] keywordsArray; + bool setup; + + static Beautify beautify; + static Material bMat; + static ScriptableRenderer renderer; +#if UNITY_2022_2_OR_NEWER + static RTHandle source; +#else + static RenderTargetIdentifier source; +#endif + static CameraData cameraData; + static RenderTextureDescriptor sourceDesc, sourceDescHP; + static bool supportsFPTextures; + static BloomMipData[] rt, rtAF; + static int[] rtEA; + static Texture2D dirtTexture, flareTex; + + class PerCamData { + public RenderTexture rtEAacum, rtEAHist; + public RTHandle rtSunFlaresOcclusion; + public float sunFlareCurrentIntensity; + public Vector4 sunLastScrPos; + public float sunLastRot; + public float sunFlareTime; + public float dofPrevDistance, dofLastAutofocusDistance; + public Vector4 dofLastBokehData; + } + + readonly static Dictionary perCamData = new Dictionary(); + static PerCamData camData; + static bool requiresSunFlaresOcclusionRTInit; + + static bool requiresLuminanceComputation; + static bool usesBloomAndFlares, usesDepthOfField, usesVignetting, usesSeparateOutline; + static bool usesSharpenExclusionMask; + static int sharpenExclusionLayerMask; + static Matrix4x4 matrix4x4identity = Matrix4x4.identity; + static bool supportsR8Format, supportsARGBHalfFormat; + static RenderTexture rtCapture; + + static bool usesDirectWriteToCamera; + + public bool Setup (Shader shader, ScriptableRenderer renderer, RenderingData renderingData, RenderPassEvent renderingPassEvent, bool ignorePostProcessingOption) { + + // Configures where the render pass should be injected. + beautify = VolumeManager.instance.stack.GetComponent(); + bool isActive = true; + if (beautify != null) { + isActive = beautify.IsActive(); + usesDirectWriteToCamera = beautify.directWrite.value; + canUseDepthTexture = !beautify.ignoreDepthTexture.value; + +#if UNITY_EDITOR + if (renderingData.cameraData.camera.cameraType == CameraType.SceneView) { + usesDirectWriteToCamera = false; + } +#endif + +#if UNITY_2023_3_OR_NEWER + + if (usingRenderGraph && canUseDepthTexture && beautify.outline.value && beautify.outlineCustomize.value && (beautify.outlineStageParameter.value != OutlineStage.BeforeBloom || beautify.bloomIntensity.value <= 0)) { + usesDirectWriteToCamera = false; // seprate outline can't use direct write to camera in render graph + } +#endif + +#if !UNITY_2022_3_OR_NEWER + if (usesDirectWriteToCamera) { + renderingPassEvent = RenderPassEvent.AfterRenderingPostProcessing; + renderingPassEvent++; + if (ignorePostProcessingOption) { + renderingPassEvent = RenderPassEvent.AfterRendering + 3; // queue after FinalBlit is present + } + } +#endif + } + + renderPassEvent = renderingPassEvent; + + cameraData = renderingData.cameraData; + BeautifyRenderPass.renderer = renderer; + + if (setup && cameraData.camera != null && bMat != null) return isActive; + setup = true; + + CheckSceneSettings(); + BeautifySettings.UnloadBeautify(); // reset any cached profile + + supportsFPTextures = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf); + supportsR8Format = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.R8); + + if (bMat == null) { + if (shader == null) { + Debug.LogWarning("Could not load Beautify shader. Please make sure BeautifyCore.shader is present."); + } + else { + bMat = CoreUtils.CreateEngineMaterial(shader); + bMat.SetTexture(ShaderParams.blueNoiseTex, Resources.Load("Textures/blueNoise")); + } + } + + // Initialize bloom buffers descriptors + if (rt == null || rt.Length != PYRAMID_COUNT_BLOOM + 1) { + rt = new BloomMipData[PYRAMID_COUNT_BLOOM + 1]; + } + for (int k = 0; k < rt.Length; k++) { + rt[k].rtDown = rt[k].rtDownOriginal = Shader.PropertyToID("_BeautifyBloomDownMip" + k); + rt[k].rtUp = rt[k].rtUpOriginal = Shader.PropertyToID("_BeautifyBloomUpMip" + k); + } + + // Initialize anamorphic flare buffers descriptors + if (rtAF == null || rtAF.Length != PYRAMID_COUNT_BLOOM + 1) { + rtAF = new BloomMipData[PYRAMID_COUNT_BLOOM + 1]; + } + for (int k = 0; k < rtAF.Length; k++) { + rtAF[k].rtDown = rtAF[k].rtDownOriginal = Shader.PropertyToID("_BeautifyAFDownMip" + k); + rtAF[k].rtUp = rtAF[k].rtUpOriginal = Shader.PropertyToID("_BeautifyAFUpMip" + k); + } + + // Initialize eye adaptation buffers descriptors + if (rtEA == null || rtEA.Length != PYRAMID_COUNT_EA) { + rtEA = new int[PYRAMID_COUNT_EA]; + } + for (int k = 0; k < rtEA.Length; k++) { + rtEA[k] = Shader.PropertyToID("_BeautifyEAMip" + k); + } + return isActive; + } + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Configure (CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { + + if (bMat == null) return; + + if (beautify == null) { + beautify = VolumeManager.instance.stack.GetComponent(); + } + if (beautify == null || !beautify.IsActive()) return; + + sourceDesc = cameraTextureDescriptor; + sourceDesc.msaaSamples = 1; + sourceDesc.depthBufferBits = 0; + + if (beautify.downsampling.value) { + UniversalRenderPipelineAsset pipe = (UniversalRenderPipelineAsset)GraphicsSettings.currentRenderPipeline; + float downsamplingMultiplier = 1f / beautify.downsamplingMultiplier.value; + if (downsamplingMultiplier < 1f) { + DownsamplingMode mode = beautify.downsamplingMode.value; + if (mode == DownsamplingMode.BeautifyEffectsOnly) { + sourceDesc.width = (int)(sourceDesc.width * downsamplingMultiplier); + sourceDesc.height = (int)(sourceDesc.height * downsamplingMultiplier); + if (pipe.renderScale != 1f) { + pipe.renderScale = 1f; + } + } + else { + if (pipe.renderScale != downsamplingMultiplier) { + pipe.renderScale = downsamplingMultiplier; + beautify.downsamplingMultiplier.value = 1f / pipe.renderScale; + } + } + } + else { + if (pipe.renderScale != 1f) { + pipe.renderScale = 1f; + } + } + } + + sourceDescHP = sourceDesc; + if (supportsFPTextures) { + sourceDescHP.colorFormat = RenderTextureFormat.ARGBHalf; + } + + if (!beautify.ignoreDepthTexture.value) { + ConfigureInput(ScriptableRenderPassInput.Depth); + } + } + +#if UNITY_2022_1_OR_NEWER + public void SetupRenderTargets(ScriptableRenderer renderer) { + BeautifyRenderPass.renderer = renderer; +#if UNITY_2022_2_OR_NEWER +#pragma warning disable CS0618 + source = renderer.cameraColorTargetHandle; +#pragma warning restore CS0618 +#else + source = renderer.cameraColorTarget; +#endif + } +#else + public override void OnCameraSetup (CommandBuffer cmd, ref RenderingData renderingData) { + source = renderer.cameraColorTarget; + } +#endif + + + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Execute (ScriptableRenderContext context, ref RenderingData renderingData) { + if (bMat == null) { + Debug.LogError("Beautify material not initialized."); + return; + } + + Camera cam = cameraData.camera; + if (beautify == null || cam == null || !beautify.IsActive()) return; + +#if !UNITY_2022_1_OR_NEWER + if (!usesDirectWriteToCamera) { + source = renderer.cameraColorTarget; + } +#endif + var cmd = CommandBufferPool.Get("Beautify"); + + passData.camera = cam; + passData.cmd = cmd; + + ExecutePass(passData); + context.ExecuteCommandBuffer(cmd); + + CommandBufferPool.Release(cmd); + } + + +#if UNITY_2023_3_OR_NEWER + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { + + using (var builder = renderGraph.AddUnsafePass("Beautify Pass RG", out var passData)) { + passData.camera = frameData.Get().camera; + + UniversalResourceData resourceData = frameData.Get(); + passData.colorTexture = resourceData.activeColorTexture; + + builder.UseTexture(resourceData.activeColorTexture, AccessFlags.ReadWrite); + if (!beautify.ignoreDepthTexture.value) { + builder.UseTexture(resourceData.activeDepthTexture, AccessFlags.Read); + ConfigureInput(ScriptableRenderPassInput.Depth); + } + + if (usesDirectWriteToCamera) { + if (resourceData.isActiveTargetBackBuffer) { + usesDirectWriteToCamera = false; + } else { + var cameraData = frameData.Get(); + var descriptor = cameraData.cameraTargetDescriptor; + descriptor.msaaSamples = 1; + descriptor.depthBufferBits = 0; + directWriteTextureHandle = UniversalRenderer.CreateRenderGraphTexture(renderGraph, descriptor, "BlitMaterialRefTex_Beautify", false); + resourceData.cameraColor = directWriteTextureHandle; + builder.UseTexture(directWriteTextureHandle, AccessFlags.WriteAll); + } + } + + builder.SetRenderFunc((PassData passData, UnsafeGraphContext context) => { + CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd); + passData.cmd = cmd; + source = passData.colorTexture; + + if (bMat == null) return; + + if (beautify == null) { + beautify = VolumeManager.instance.stack.GetComponent(); + } + if (beautify == null || !beautify.IsActive()) return; + + if (source.rt != null) { + sourceDesc = source.rt.descriptor; + } + sourceDesc.msaaSamples = 1; + sourceDesc.depthBufferBits = 0; + + if (beautify.downsampling.value) { + UniversalRenderPipelineAsset pipe = (UniversalRenderPipelineAsset)GraphicsSettings.currentRenderPipeline; + float downsamplingMultiplier = 1f / beautify.downsamplingMultiplier.value; + if (downsamplingMultiplier < 1f) { + DownsamplingMode mode = beautify.downsamplingMode.value; + if (mode == DownsamplingMode.BeautifyEffectsOnly) { + sourceDesc.width = (int)(sourceDesc.width * downsamplingMultiplier); + sourceDesc.height = (int)(sourceDesc.height * downsamplingMultiplier); + if (pipe.renderScale != 1f) { + pipe.renderScale = 1f; + } + } else { + if (pipe.renderScale != downsamplingMultiplier) { + pipe.renderScale = downsamplingMultiplier; + beautify.downsamplingMultiplier.value = 1f / pipe.renderScale; + } + } + } + else { + if (pipe.renderScale != 1f) { + pipe.renderScale = 1f; + } + } + } + + sourceDescHP = sourceDesc; + if (supportsFPTextures) { + sourceDescHP.colorFormat = RenderTextureFormat.ARGBHalf; + } + + ExecutePass(passData); + }); + } + } +#endif + + static void ExecutePass (PassData passData) { + + Camera cam = passData.camera; + CommandBuffer cmd = passData.cmd; + +#if UNITY_EDITOR + if (requestScreenCapture && cam != null && cam.cameraType == captureCameraType) { + requestScreenCapture = false; + if (rtCapture != null) { + rtCapture.Release(); + } + rtCapture = new RenderTexture(sourceDesc); + FullScreenBlit(cmd, source, rtCapture, bMat, (int)Pass.CopyExact); + cmd.SetGlobalTexture(ShaderParams.lutPreview, rtCapture); + } + else { + if (cam.cameraType == CameraType.SceneView && beautify.hideInSceneView.value && !requestScreenCapture) return; + } +#else + if (cam.cameraType == CameraType.SceneView && beautify.hideInSceneView.value) return; +#endif + + + RestoreRTBufferIds(); + + bMat.SetFloat(ShaderParams.flipY, beautify.flipY.value ? -1 : 1); // workaround for 2D renderer bug with camera stacking + + if (requiresLuminanceComputation || usesBloomAndFlares || usesDepthOfField) { + if (!perCamData.TryGetValue(cam, out camData)) { + camData = new PerCamData(); + perCamData[cam] = camData; + } + if (camData.rtSunFlaresOcclusion == null) { + camData.rtSunFlaresOcclusion = RTHandles.Alloc(2, 2, colorFormat: UnityEngine.Experimental.Rendering.GraphicsFormat.R16G16B16A16_SFloat); + requiresSunFlaresOcclusionRTInit = true; + } + else { + requiresSunFlaresOcclusionRTInit = false; + } + } + + if (usesSeparateOutline && beautify.outlineStageParameter.value == OutlineStage.BeforeBloom) { + DoSeparateOutline(cmd); + } + + bool dofAffectsBloom = usesDepthOfField && usesBloomAndFlares && beautify.depthOfFieldAffectsBloom.value; + if (dofAffectsBloom) { + DoDoF(cmd); + } + + if (usesBloomAndFlares) { + DoBloomAndFlares(cmd, dofAffectsBloom); + } + + if (usesSeparateOutline && beautify.outlineStageParameter.value == OutlineStage.AfterBloom) { + DoSeparateOutline(cmd); + } + + if (requiresLuminanceComputation) { + DoEyeAdaptation(cmd); + } + + if (usesDepthOfField && !dofAffectsBloom) { + DoDoF(cmd); + } + + if (usesVignetting) { + DoVignette(); + } + + bool usesChromaticAberrationAsPost = beautify.chromaticAberrationIntensity.value > 0 && (beautify.depthOfField.value || beautify.chromaticAberrationSeparatePass.value); + bool usesFinalBlur = beautify.blurIntensity.value > 0; + int blurComposePass = usesFinalBlur && beautify.blurKeepSourceOnTop.value ? (int)Pass.CopyWithMiniView : (int)Pass.CopyBilinear; + + if (usesDirectWriteToCamera) { + // direct output to camera + if (beautify.debugOutput.value == DebugOutput.DepthOfFieldCoC) { + if (beautify.depthOfField.value) { + // we ignore input contents + FullScreenBlitToCamera(cmd, source, BuiltinRenderTextureType.CameraTarget, bMat, (int)Pass.DoFCoCDebug); + } + } + else if (beautify.debugOutput.value == DebugOutput.BloomAndFlares) { + if (beautify.bloomIntensity.value > 0 || beautify.anamorphicFlaresIntensity.value > 0 || beautify.sunFlaresIntensity.value > 0 || beautify.lensDirtIntensity.value > 0) { + // we ignore input contents + FullScreenBlitToCamera(cmd, source, BuiltinRenderTextureType.CameraTarget, bMat, (int)Pass.BloomDebug); + } + } + else if (beautify.debugOutput.value == DebugOutput.BloomExclusionPass) { + if (beautify.bloomIntensity.value > 0 && beautify.bloomExcludeLayers.value) { + // we ignore input contents + FullScreenBlitToCamera(cmd, source, BuiltinRenderTextureType.CameraTarget, bMat, (int)Pass.BloomExclusionLayerDebug); + } + } + else if (beautify.debugOutput.value == DebugOutput.AnamorphicFlaresExclusionPass) { + if (beautify.anamorphicFlaresIntensity.value > 0 && beautify.anamorphicFlaresExcludeLayers.value) { + // we ignore input contents + FullScreenBlitToCamera(cmd, source, BuiltinRenderTextureType.CameraTarget, bMat, (int)Pass.AnamorphicFlaresExclusionLayerDebug); + } + } + else if (beautify.debugOutput.value == DebugOutput.DepthOfFieldTransparentPass) { + if (beautify.depthOfField.value && (beautify.depthOfFieldTransparentSupport.value || beautify.depthOfFieldAlphaTestSupport.value)) { + // we ignore input contents + FullScreenBlitToCamera(cmd, source, BuiltinRenderTextureType.CameraTarget, bMat, (int)Pass.DoFDebugTransparent); + } + } + else if (beautify.compareMode.value) { + cmd.GetTemporaryRT(ShaderParams.compareTex, sourceDesc, FilterMode.Point); + if (usesChromaticAberrationAsPost) { + // chromatic aberration added as a post-pass due to depth of field + cmd.GetTemporaryRT(ShaderParams.chromaticTempTex, sourceDesc, FilterMode.Point); + FullScreenBlit(cmd, source, ShaderParams.chromaticTempTex, bMat, (int)Pass.Beautify); + FullScreenBlit(cmd, ShaderParams.chromaticTempTex, ShaderParams.compareTex, bMat, (int)Pass.ChromaticAberration); + cmd.ReleaseTemporaryRT(ShaderParams.chromaticTempTex); + } + else { + FullScreenBlit(cmd, source, ShaderParams.compareTex, bMat, (int)Pass.Beautify); + } + if (usesFinalBlur) { + // final blur + int blurSource = ApplyFinalBlur(cmd, ShaderParams.compareTex); + FullScreenBlit(cmd, blurSource, ShaderParams.compareTex, bMat, blurComposePass); + } + FullScreenBlitToCamera(cmd, source, BuiltinRenderTextureType.CameraTarget, bMat, (int)Pass.Compare); + cmd.ReleaseTemporaryRT(ShaderParams.compareTex); + } + else { + RenderTargetIdentifier preBlurDest = BuiltinRenderTextureType.CameraTarget; + if (usesFinalBlur) { + cmd.GetTemporaryRT(ShaderParams.inputTex, sourceDesc, FilterMode.Point); + preBlurDest = ShaderParams.inputTex; + } + if (usesChromaticAberrationAsPost) { + // chromatic aberration added as a post-pass due to depth of field + cmd.GetTemporaryRT(ShaderParams.chromaticTempTex, sourceDesc, FilterMode.Point); + FullScreenBlit(cmd, source, ShaderParams.chromaticTempTex, bMat, (int)Pass.Beautify); + FullScreenBlitToCamera(cmd, ShaderParams.chromaticTempTex, preBlurDest, bMat, (int)Pass.ChromaticAberration); + cmd.ReleaseTemporaryRT(ShaderParams.chromaticTempTex); + } + else { + FullScreenBlitToCamera(cmd, source, preBlurDest, bMat, (int)Pass.Beautify); + } + if (usesFinalBlur) { + // final blur + int blurSource = ApplyFinalBlur(cmd, preBlurDest); + FullScreenBlitToCamera(cmd, blurSource, BuiltinRenderTextureType.CameraTarget, bMat, blurComposePass); + cmd.ReleaseTemporaryRT(ShaderParams.inputTex); + } + } + + } + else { + + // non direct to camera + + bool useBilinearFiltering = beautify.downsampling.value && beautify.downsamplingMultiplier.value > 1f && beautify.downsamplingBilinear.value; + int copyPass = useBilinearFiltering ? (int)Pass.CopyBilinear : (int)Pass.CopyExact; + + cmd.GetTemporaryRT(ShaderParams.inputTex, sourceDesc, (!beautify.downsampling.value || (beautify.downsamplingMultiplier.value > 1f && !beautify.downsamplingBilinear.value)) ? FilterMode.Point : FilterMode.Bilinear); + + if (beautify.debugOutput.value == DebugOutput.DepthOfFieldCoC) { + if (beautify.depthOfField.value) { + // we ignore input contents + FullScreenBlit(cmd, ShaderParams.inputTex, source, bMat, (int)Pass.DoFCoCDebug); + } + } + else if (beautify.debugOutput.value == DebugOutput.BloomAndFlares) { + if (beautify.bloomIntensity.value > 0 || beautify.anamorphicFlaresIntensity.value > 0 || beautify.sunFlaresIntensity.value > 0 || beautify.lensDirtIntensity.value > 0) { + // we ignore input contents + FullScreenBlit(cmd, ShaderParams.inputTex, source, bMat, (int)Pass.BloomDebug); + } + } + else if (beautify.debugOutput.value == DebugOutput.BloomExclusionPass) { + if (beautify.bloomIntensity.value > 0 && beautify.bloomExcludeLayers.value) { + // we ignore input contents + FullScreenBlit(cmd, ShaderParams.inputTex, source, bMat, (int)Pass.BloomExclusionLayerDebug); + } + } + else if (beautify.debugOutput.value == DebugOutput.AnamorphicFlaresExclusionPass) { + if (beautify.anamorphicFlaresIntensity.value > 0 && beautify.anamorphicFlaresExcludeLayers.value) { + // we ignore input contents + FullScreenBlit(cmd, ShaderParams.inputTex, source, bMat, (int)Pass.AnamorphicFlaresExclusionLayerDebug); + } + } + else if (beautify.debugOutput.value == DebugOutput.DepthOfFieldTransparentPass) { + if (beautify.depthOfField.value && (beautify.depthOfFieldTransparentSupport.value || beautify.depthOfFieldAlphaTestSupport.value)) { + // we ignore input contents + FullScreenBlit(cmd, ShaderParams.inputTex, source, bMat, (int)Pass.DoFDebugTransparent); + } + } + else if (beautify.compareMode.value) { + cmd.GetTemporaryRT(ShaderParams.compareTex, sourceDesc, FilterMode.Point); + if (usesChromaticAberrationAsPost) { + // chromatic aberration added as a post-pass due to depth of field + FullScreenBlit(cmd, source, ShaderParams.inputTex, bMat, (int)Pass.Beautify); + FullScreenBlit(cmd, ShaderParams.inputTex, ShaderParams.compareTex, bMat, (int)Pass.ChromaticAberration); + } + else { + FullScreenBlit(cmd, source, ShaderParams.compareTex, bMat, (int)Pass.Beautify); + } + if (usesFinalBlur) { + // final blur + int blurSource = ApplyFinalBlur(cmd, ShaderParams.compareTex); + FullScreenBlit(cmd, blurSource, ShaderParams.compareTex, bMat, blurComposePass); + } + FullScreenBlit(cmd, source, ShaderParams.inputTex, bMat, copyPass); + FullScreenBlit(cmd, ShaderParams.inputTex, source, bMat, (int)Pass.Compare); + cmd.ReleaseTemporaryRT(ShaderParams.compareTex); + } + else { + if (usesChromaticAberrationAsPost) { + // chromatic aberration added as a post-pass due to depth of field + FullScreenBlit(cmd, source, ShaderParams.inputTex, bMat, (int)Pass.Beautify); + FullScreenBlit(cmd, ShaderParams.inputTex, source, bMat, (int)Pass.ChromaticAberration); + } + else { + FullScreenBlit(cmd, source, ShaderParams.inputTex, bMat, copyPass); + FullScreenBlit(cmd, ShaderParams.inputTex, source, bMat, (int)Pass.Beautify); + } + if (usesFinalBlur) { + // final blur + int blurSource = ApplyFinalBlur(cmd, source); + FullScreenBlit(cmd, blurSource, source, bMat, blurComposePass); + } + cmd.ReleaseTemporaryRT(ShaderParams.miniViewTex); + } + + cmd.ReleaseTemporaryRT(ShaderParams.inputTex); + } + + } + + static Mesh _fullScreenMesh; + + static Mesh fullscreenMesh { + get { + if (_fullScreenMesh != null) { + return _fullScreenMesh; + } + Mesh val = new Mesh(); + _fullScreenMesh = val; + _fullScreenMesh.SetVertices(new List { + new Vector3 (-1f, -1f, 0f), + new Vector3 (-1f, 1f, 0f), + new Vector3 (1f, -1f, 0f), + new Vector3 (1f, 1f, 0f) + }); + _fullScreenMesh.SetUVs(0, new List { + new Vector2 (0f, 0f), + new Vector2 (0f, 1f), + new Vector2 (1f, 0f), + new Vector2 (1f, 1f) + }); + _fullScreenMesh.SetIndices(new int[6] { 0, 1, 2, 2, 1, 3 }, (MeshTopology)0, 0, false); + _fullScreenMesh.UploadMeshData(true); + return _fullScreenMesh; + } + } + + + static void FullScreenBlit (CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material, int passIndex) { + destination = new RenderTargetIdentifier(destination, 0, CubemapFace.Unknown, -1); + cmd.SetRenderTarget(destination); + cmd.SetGlobalTexture(ShaderParams.mainTex, source); + cmd.DrawMesh(fullscreenMesh, matrix4x4identity, material, 0, passIndex); + } + + static void FullScreenBlitToCamera (CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material, int passIndex) { +#if UNITY_2022_3_OR_NEWER + // if destination is camera, make use of swap buffers + if (destination == BuiltinRenderTextureType.CameraTarget) { +#if UNITY_2023_3_OR_NEWER + if (usingRenderGraph) { + RenderTargetIdentifier dest = directWriteTextureHandle; + dest = new RenderTargetIdentifier(dest, 0, CubemapFace.Unknown, -1); + cmd.SetRenderTarget(dest); + cmd.SetGlobalTexture(ShaderParams.mainTex, source); + cmd.DrawMesh(fullscreenMesh, matrix4x4identity, material, 0, passIndex); + } else +#endif + { +#pragma warning disable 0618 + RenderTargetIdentifier dest = renderer.GetCameraColorFrontBuffer(cmd); +#pragma warning restore 0618 + dest = new RenderTargetIdentifier(dest, 0, CubemapFace.Unknown, -1); + cmd.SetRenderTarget(dest); + cmd.SetGlobalTexture(ShaderParams.mainTex, source); + cmd.DrawMesh(fullscreenMesh, matrix4x4identity, material, 0, passIndex); + renderer.SwapColorBuffer(cmd); + } + return; + } +#endif + FullScreenBlit(cmd, source, destination, material, passIndex); + } + + + public void Cleanup () { + + UniversalRenderPipelineAsset pipe = (UniversalRenderPipelineAsset)GraphicsSettings.currentRenderPipeline; + if (beautify != null && pipe != null && beautify.downsampling.value) { + pipe.renderScale = 1f; + } + + CoreUtils.Destroy(bMat); + + foreach (PerCamData data in perCamData.Values) { + if (data.rtSunFlaresOcclusion != null) { + data.rtSunFlaresOcclusion.Release(); + } + } + +#if UNITY_EDITOR + if (rtCapture != null) { + rtCapture.Release(); + } +#endif + } + + + static void RestoreRTBufferIds () { + // Restore temorary rt ids + for (int k = 0; k < rt.Length; k++) { + rt[k].rtDown = rt[k].rtDownOriginal; + rt[k].rtUp = rt[k].rtUpOriginal; + } + for (int k = 0; k < rtAF.Length; k++) { + rtAF[k].rtDown = rtAF[k].rtDownOriginal; + rtAF[k].rtUp = rtAF[k].rtUpOriginal; + } + ShaderParams.tempBlurOneDirRT = ShaderParams.tempBlurOneDirRTOriginal; + ShaderParams.tempBloomCustomComposeRT = ShaderParams.tempBloomCustomComposeRTOriginal; + } + + static int ApplyFinalBlur (CommandBuffer cmd, RenderTargetIdentifier source) { + + if (beautify.blurKeepSourceOnTop.value) { + Vector4 rect = beautify.blurSourceRect.value; + RenderTextureDescriptor miniViewDesc = sourceDesc; + miniViewDesc.width = (int)(miniViewDesc.width * rect.z); + if (miniViewDesc.width < 1) miniViewDesc.width = 1; + miniViewDesc.height = (int)(miniViewDesc.height * rect.w); + if (miniViewDesc.height < 1) miniViewDesc.height = 1; + cmd.GetTemporaryRT(ShaderParams.miniViewTex, miniViewDesc, FilterMode.Bilinear); + FullScreenBlit(cmd, source, ShaderParams.miniViewTex, bMat, (int)Pass.CopyBilinear); + bMat.SetVector(ShaderParams.miniViewRect, rect); + float fparam = (1.00001f - beautify.blurSourceEdgeBlendWidth.value) * 0.5f; + float wparam = beautify.blurSourceEdgeBlendStrength.value; + bMat.SetVector(ShaderParams.miniViewBlend, new Vector4(fparam, wparam, fparam, wparam)); + } + + int size; + RenderTextureDescriptor rtBlurDesc = sourceDescHP; + + float blurIntensity = beautify.blurIntensity.value; + if (blurIntensity < 1f) { + size = (int)Mathf.Lerp(rtBlurDesc.width, 512, blurIntensity); + } + else { + size = (int)(512 / blurIntensity); + } + float aspectRatio = (float)sourceDesc.height / sourceDesc.width; + rtBlurDesc.width = size; + rtBlurDesc.height = Mathf.Max(1, (int)(size * aspectRatio)); + cmd.GetTemporaryRT(ShaderParams.blurRT, rtBlurDesc, FilterMode.Bilinear); + + float ratio = (float)sourceDesc.width / size; + float blurScale = blurIntensity > 1f ? 1f : blurIntensity; + + cmd.GetTemporaryRT(ShaderParams.tempBlurDownscaling, rtBlurDesc, FilterMode.Bilinear); + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale * ratio); + FullScreenBlit(cmd, source, ShaderParams.tempBlurDownscaling, bMat, (int)Pass.BlurHoriz); + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale); + FullScreenBlit(cmd, ShaderParams.tempBlurDownscaling, ShaderParams.blurRT, bMat, (int)Pass.BlurVert); + cmd.ReleaseTemporaryRT(ShaderParams.tempBlurDownscaling); + + BlurThis(cmd, rtBlurDesc, ShaderParams.blurRT, rtBlurDesc.width, rtBlurDesc.height, bMat, blurScale); + if (!beautify.turboMode.value) { + BlurThis(cmd, rtBlurDesc, ShaderParams.blurRT, rtBlurDesc.width, rtBlurDesc.height, bMat, blurScale); + BlurThis(cmd, rtBlurDesc, ShaderParams.blurRT, rtBlurDesc.width, rtBlurDesc.height, bMat, blurScale); + } + + if (beautify.blurMask.value != null) { + cmd.GetTemporaryRT(ShaderParams.blurMaskedRT, sourceDesc); + FullScreenBlit(cmd, source, ShaderParams.blurMaskedRT, bMat, (int)Pass.BlurMask); + return ShaderParams.blurMaskedRT; + } + else { + return ShaderParams.blurRT; + } + } + + + + static void DoBloomAndFlares (CommandBuffer cmd, bool dofAffectsBloom) { + + Camera cam = cameraData.camera; + bool sunFlareEnabled = false; + if (beautify.sunFlaresIntensity.value > 0) { + CheckSun(); + sunFlareEnabled = sceneSettings != null && sceneSettings.sun != null; + } + + RenderTargetIdentifier source = dofAffectsBloom ? ShaderParams.dofRT : BeautifyRenderPass.source; + + if (beautify.lensDirtIntensity.value > 0 || beautify.bloomIntensity.value > 0 || beautify.anamorphicFlaresIntensity.value > 0 || sunFlareEnabled) { + + int mipCount = beautify.turboMode.value ? PYRAMID_COUNT_BLOOM_TURBO : PYRAMID_COUNT_BLOOM; + float aspectRatio = (float)sourceDesc.height / sourceDesc.width; + int rtBloom = -1; + int downsamping = beautify.turboMode.value ? 4 : 2; + int lensDirtSpread = beautify.turboMode.value ? 2 : beautify.lensDirtSpread.value; + + if (beautify.bloomIntensity.value > 0 || (beautify.lensDirtIntensity.value > 0 && beautify.anamorphicFlaresIntensity.value <= 0)) { + + int size = (int)(Mathf.Lerp(512, sourceDesc.width, beautify.bloomResolution.value / 10f) / 4f) * 4; + RenderTextureDescriptor bloomDesc = sourceDescHP; + for (int k = 0; k <= mipCount; k++) { + rt[k].width = size; + rt[k].height = Mathf.Max(1, (int)(size * aspectRatio)); + bloomDesc.width = rt[k].width; + bloomDesc.height = rt[k].height; + cmd.ReleaseTemporaryRT(rt[k].rtDown); + cmd.GetTemporaryRT(rt[k].rtDown, bloomDesc, FilterMode.Bilinear); + cmd.ReleaseTemporaryRT(rt[k].rtUp); + cmd.GetTemporaryRT(rt[k].rtUp, bloomDesc, FilterMode.Bilinear); + size /= downsamping; + } + + rtBloom = rt[0].rtDown; + if (beautify.bloomAntiflicker.value) { + FullScreenBlit(cmd, source, rtBloom, bMat, (int)Pass.BloomLuminanceAntiflicker); + } + else { + FullScreenBlit(cmd, source, rtBloom, bMat, (int)Pass.BloomLuminance); + } + + // Blitting down... + if (beautify.bloomQuickerBlur.value) { + for (int k = 0; k < mipCount; k++) { + BlurThisDownsampling(cmd, bloomDesc, rt[k].rtDown, rt[k + 1].rtDown, rt[k + 1].width, rt[k + 1].height, bMat); + } + } + else { + for (int k = 0; k < mipCount; k++) { + FullScreenBlit(cmd, rt[k].rtDown, rt[k + 1].rtDown, bMat, (int)Pass.BloomResample); + BlurThis(cmd, bloomDesc, rt[k + 1].rtDown, rt[k + 1].width, rt[k + 1].height, bMat); + } + } + if (beautify.bloomIntensity.value > 0 || beautify.lensDirtIntensity.value > 0) { + // Blitting up... + rtBloom = rt[mipCount].rtDown; + for (int k = mipCount; k > 0; k--) { + cmd.SetGlobalTexture(ShaderParams.bloomTex, rt[k - 1].rtDown); + FullScreenBlit(cmd, rtBloom, rt[k - 1].rtUp, bMat, (int)Pass.BloomResampleAndCombine); + rtBloom = rt[k - 1].rtUp; + } + if (beautify.bloomCustomize.value) { + cmd.SetGlobalTexture(ShaderParams.bloomTex4, mipCount < 4 ? rt[3].rtUp : rt[4].rtUp); + cmd.SetGlobalTexture(ShaderParams.bloomTex3, rt[3].rtUp); + cmd.SetGlobalTexture(ShaderParams.bloomTex2, rt[2].rtUp); + cmd.SetGlobalTexture(ShaderParams.bloomTex1, rt[1].rtUp); + cmd.SetGlobalTexture(ShaderParams.bloomTex, rt[0].rtUp); + bloomDesc.width = rt[0].width; + bloomDesc.height = rt[0].height; + cmd.ReleaseTemporaryRT(ShaderParams.tempBloomCustomComposeRT); + cmd.GetTemporaryRT(ShaderParams.tempBloomCustomComposeRT, bloomDesc, FilterMode.Bilinear); + rtBloom = ShaderParams.tempBloomCustomComposeRT; + FullScreenBlit(cmd, rt[mipCount].rtUp, rtBloom, bMat, (int)Pass.BloomCompose); + } + } + } + + // anamorphic flares + if (beautify.anamorphicFlaresIntensity.value > 0) { + + int sizeAF = (int)(Mathf.Lerp(512, sourceDescHP.width, beautify.anamorphicFlaresResolution.value / 10f) / 4f) * 4; + + RenderTextureDescriptor afDesc = sourceDescHP; + + float spread = (1920 / 1080f) * beautify.anamorphicFlaresSpread.value * sizeAF / 512f; + for (int origSize = sizeAF, k = 0; k <= mipCount; k++) { + int w = Mathf.Max(1, (int)(sizeAF / spread)); + if (beautify.anamorphicFlaresVertical.value) { + rtAF[k].width = origSize; + rtAF[k].height = w; + } + else { + rtAF[k].width = w; + rtAF[k].height = origSize; + } + afDesc.width = rtAF[k].width; + afDesc.height = rtAF[k].height; + cmd.ReleaseTemporaryRT(rtAF[k].rtDown); + cmd.GetTemporaryRT(rtAF[k].rtDown, afDesc, FilterMode.Bilinear); + cmd.ReleaseTemporaryRT(rtAF[k].rtUp); + cmd.GetTemporaryRT(rtAF[k].rtUp, afDesc, FilterMode.Bilinear); + sizeAF /= downsamping; + } + + if (beautify.anamorphicFlaresAntiflicker.value) { + FullScreenBlit(cmd, source, rtAF[0].rtDown, bMat, (int)Pass.AnamorphicFlaresLuminanceAntiflicker); + } + else { + FullScreenBlit(cmd, source, rtAF[0].rtDown, bMat, (int)Pass.AnamorphicFlaresLuminance); + } + + BlurThisOneDirection(cmd, afDesc, ref rtAF[0].rtDown, rtAF[0].width, rtAF[0].height, beautify.anamorphicFlaresVertical.value); + + if (beautify.anamorphicFlaresQuickerBlur.value) { + for (int k = 0; k < mipCount; k++) { + BlurThisOneDirectionDownscaling(cmd, afDesc, rtAF[k].rtDown, rtAF[k + 1].rtDown, rtAF[k + 1].width, rtAF[k + 1].height, beautify.anamorphicFlaresVertical.value); + } + } + else { + for (int k = 0; k < mipCount; k++) { + FullScreenBlit(cmd, rtAF[k].rtDown, rtAF[k + 1].rtDown, bMat, (int)Pass.BloomResample); + BlurThisOneDirection(cmd, afDesc, ref rtAF[k + 1].rtDown, rtAF[k + 1].width, rtAF[k + 1].height, beautify.anamorphicFlaresVertical.value); + } + } + + int last = rtAF[mipCount].rtDown; + for (int k = mipCount; k > 0; k--) { + cmd.SetGlobalTexture(ShaderParams.bloomTex, rtAF[k].rtDown); + if (k == 1) { + FullScreenBlit(cmd, last, rtAF[k - 1].rtUp, bMat, (int)Pass.AnamorphicFlaresResample); // applies intensity in last stage + } + else { + FullScreenBlit(cmd, last, rtAF[k - 1].rtUp, bMat, (int)Pass.BloomResampleAndCombine); + } + last = rtAF[k - 1].rtUp; + } + if (beautify.bloomIntensity.value > 0) { + if (beautify.lensDirtIntensity.value > 0) { + BlendOneOne(cmd, rtAF[lensDirtSpread].rtUp, ref rt[lensDirtSpread].rtUp, ref rt[lensDirtSpread].rtDown); + } + BlendOneOne(cmd, last, ref rtBloom, ref rt[0].rtDown); + } + else { + rtBloom = last; + } + } + + if (sunFlareEnabled) { + // check if Sun is visible + Vector3 sunDirection = sceneSettings.sun.transform.forward; + Vector3 sunWorldPosition = cam.transform.position - sunDirection * 1000f; + float flareIntensity = 0; + Vector3 sunScrPos = cam.WorldToViewportPoint(sunWorldPosition); + bool sunVisible = sunScrPos.z > 0 && sunScrPos.x >= -0.1f && sunScrPos.x < 1.1f && sunScrPos.y >= -0.1f && sunScrPos.y < 1.1f; + if (sunVisible) { + if (beautify.sunFlaresUseLayerMask.value) { + Ray ray = new Ray(cam.transform.position, -sunDirection); + if (Physics.Raycast(ray, cam.farClipPlane, beautify.sunFlaresLayerMask.value)) { + sunVisible = false; + } + } + if (sunVisible) { + Vector2 dd = sunScrPos - new Vector3(0.5f, 0.5f, 0.5f); + flareIntensity = beautify.sunFlaresIntensity.value * Mathf.Clamp01((0.7f - Mathf.Max(Mathf.Abs(dd.x), Mathf.Abs(dd.y))) / 0.7f); + } + } + + if (beautify.bloomIntensity.value <= 0 && beautify.anamorphicFlaresIntensity.value <= 0) { // ensure _Bloom.x is 1 into the shader for sun flares to be visible if no bloom nor anamorphic flares are enabled + bMat.SetVector(ShaderParams.bloom, Vector4.one); + } + else { + flareIntensity /= (beautify.bloomIntensity.value + 0.0001f); + } + camData.sunFlareCurrentIntensity = Mathf.Lerp(camData.sunFlareCurrentIntensity, flareIntensity, Application.isPlaying ? beautify.sunFlaresAttenSpeed.value * Time.deltaTime : 1f); + if (camData.sunFlareCurrentIntensity > 0) { + if (flareIntensity > 0) { + camData.sunLastScrPos = sunScrPos; + if (canUseDepthTexture) { + if (beautify.sunFlaresDepthOcclusionMode.value == SunFlaresDepthOcclusionMode.Smooth) { + if (requiresSunFlaresOcclusionRTInit || !Application.isPlaying) { + bMat.EnableKeyword(ShaderParams.SKW_SUN_FLARES_OCCLUSION_INIT); + } + else { + bMat.DisableKeyword(ShaderParams.SKW_SUN_FLARES_OCCLUSION_INIT); + } + FullScreenBlit(cmd, source, camData.rtSunFlaresOcclusion, bMat, (int)Pass.SunFlaresOcclusionTest); + } + } + } + + bMat.SetTexture(ShaderParams.sfOcclusionTex, camData.rtSunFlaresOcclusion); + Color sunTintColor = beautify.sunFlaresTint.value; + sunTintColor.r *= camData.sunFlareCurrentIntensity; + sunTintColor.g *= camData.sunFlareCurrentIntensity; + sunTintColor.b *= camData.sunFlareCurrentIntensity; + sunTintColor.a = beautify.sunFlaresAttenSpeed.value; + + bMat.SetColor(ShaderParams.sfSunTintColor, sunTintColor); + camData.sunLastScrPos.z = 0.5f + camData.sunFlareTime * beautify.sunFlaresSolarWindSpeed.value; + Vector2 sfDist = new Vector2(0.5f - camData.sunLastScrPos.y, camData.sunLastScrPos.x - 0.5f); + if (!beautify.sunFlaresRotationDeadZone.value || sfDist.sqrMagnitude > 0.00025f) { + camData.sunLastRot = Mathf.Atan2(sfDist.x, sfDist.y); + } + camData.sunLastScrPos.w = camData.sunLastRot; + camData.sunFlareTime += Time.unscaledDeltaTime; + bMat.SetVector(ShaderParams.sfSunPos, camData.sunLastScrPos); + bMat.SetVector(ShaderParams.sfSunDir, sunDirection); + RenderTextureDescriptor sfDesc = sourceDesc; + sfDesc.width /= beautify.sunFlaresDownsampling.value; + sfDesc.height /= beautify.sunFlaresDownsampling.value; + bMat.SetFloat(ShaderParams.sfAspectRatio, (float)sourceDesc.height / sourceDesc.width); + cmd.GetTemporaryRT(ShaderParams.sfRT, sfDesc, FilterMode.Bilinear); + if (rtBloom >= 0) { + FullScreenBlit(cmd, rtBloom, ShaderParams.sfRT, bMat, (int)Pass.SunFlaresAdditive); + } + else { + FullScreenBlit(cmd, source, ShaderParams.sfRT, bMat, (int)Pass.SunFlares); + } + if (beautify.lensDirtIntensity.value > 0 && beautify.bloomIntensity.value > 0) { + BlendOneOne(cmd, ShaderParams.sfRT, ref rt[lensDirtSpread].rtUp, ref rt[lensDirtSpread].rtDown); + } + rtBloom = ShaderParams.sfRT; + } + } + + if (rtBloom >= 0) { + cmd.SetGlobalTexture(ShaderParams.bloomTex, rtBloom); + } + else { + bMat.DisableKeyword(ShaderParams.SKW_BLOOM); + } + + if (beautify.lensDirtIntensity.value > 0) { + int rtID = (beautify.anamorphicFlaresIntensity.value > 0 && beautify.bloomIntensity.value <= 0) ? rtAF[lensDirtSpread].rtUp : rt[lensDirtSpread].rtUp; + cmd.SetGlobalTexture(ShaderParams.screenLum, rtID); + } + + } + } + + static void BlendOneOne (CommandBuffer cmd, int source, ref int destination, ref int tempBuffer) { + cmd.SetGlobalTexture(ShaderParams.afCombineTex, destination); // _BloomTex used as temporary rt for combining + FullScreenBlit(cmd, source, tempBuffer, bMat, (int)Pass.AnamorphicFlaresResampleAndCombine); + // swap buffers + int tmp = destination; + destination = tempBuffer; + tempBuffer = tmp; + } + + static void BlurThis (CommandBuffer cmd, RenderTextureDescriptor desc, int rt, int width, int height, Material blurMat, float blurScale = 1f) { + desc.width = width; + desc.height = height; + cmd.GetTemporaryRT(ShaderParams.tempBlurRT, desc, FilterMode.Bilinear); + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale); + FullScreenBlit(cmd, rt, ShaderParams.tempBlurRT, blurMat, (int)Pass.BlurHoriz); + FullScreenBlit(cmd, ShaderParams.tempBlurRT, rt, blurMat, (int)Pass.BlurVert); + cmd.ReleaseTemporaryRT(ShaderParams.tempBlurRT); + } + + static void BlurThisDownsampling (CommandBuffer cmd, RenderTextureDescriptor desc, int rtSource, int rt, int width, int height, Material blurMat, float blurScale = 1f) { + desc.width = width; + desc.height = height; + cmd.GetTemporaryRT(ShaderParams.tempBlurRT, desc, FilterMode.Bilinear); + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale * 4f); + FullScreenBlit(cmd, rtSource, ShaderParams.tempBlurRT, blurMat, (int)Pass.BlurHoriz); + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale); + FullScreenBlit(cmd, ShaderParams.tempBlurRT, rt, blurMat, (int)Pass.BlurVert); + cmd.ReleaseTemporaryRT(ShaderParams.tempBlurRT); + } + + static void BlurThisOneDirection (CommandBuffer cmd, RenderTextureDescriptor desc, ref int rt, int width, int height, bool vertical, float blurScale = 1f) { + desc.width = width; + desc.height = height; + cmd.ReleaseTemporaryRT(ShaderParams.tempBlurOneDirRT); + cmd.GetTemporaryRT(ShaderParams.tempBlurOneDirRT, desc, FilterMode.Bilinear); + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale); + FullScreenBlit(cmd, rt, ShaderParams.tempBlurOneDirRT, bMat, vertical ? (int)Pass.BlurVert : (int)Pass.BlurHoriz); + int aux = rt; + rt = ShaderParams.tempBlurOneDirRT; + ShaderParams.tempBlurOneDirRT = aux; + } + + static void BlurThisOneDirectionDownscaling (CommandBuffer cmd, RenderTextureDescriptor desc, int rtSource, int rt, int width, int height, bool vertical, float blurScale = 1f) { + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale * 2f); + FullScreenBlit(cmd, rtSource, rt, bMat, vertical ? (int)Pass.BlurVert : (int)Pass.BlurHoriz); + } + + static void DoDoF (CommandBuffer cmd) { + + Camera cam = cameraData.camera; + if (cam.cameraType != CameraType.Game) { + bMat.DisableKeyword(ShaderParams.SKW_DEPTH_OF_FIELD); + bMat.DisableKeyword(ShaderParams.SKW_DEPTH_OF_FIELD_TRANSPARENT); + return; + } + + UpdateDepthOfFieldData(cmd); + + BeautifySettings.dofTransparentLayerMask = beautify.depthOfFieldTransparentLayerMask.value; + BeautifySettings.dofTransparentDoubleSided = beautify.depthOfFieldTransparentDoubleSided.value; + + int width = cam.pixelWidth / beautify.depthOfFieldDownsampling.value; + int height = cam.pixelHeight / beautify.depthOfFieldDownsampling.value; + RenderTextureDescriptor dofDesc = sourceDescHP; + dofDesc.width = width; + dofDesc.height = height; + dofDesc.colorFormat = RenderTextureFormat.ARGBHalf; + cmd.GetTemporaryRT(ShaderParams.dofRT, dofDesc, FilterMode.Bilinear); + FullScreenBlit(cmd, source, ShaderParams.dofRT, bMat, (int)Pass.DoFCoC); + + if (beautify.depthOfFieldForegroundBlur.value && beautify.depthOfFieldForegroundBlurHQ.value) { + BlurThisAlpha(cmd, dofDesc, ShaderParams.dofRT, beautify.depthOfFieldForegroundBlurHQSpread.value); + } + + if (beautify.depthOfFieldBokehComposition.value == Beautify.DoFBokehComposition.Integrated || !beautify.depthOfFieldBokeh.value) { + Pass pass = beautify.depthOfFieldBokeh.value ? Pass.DoFBlur : Pass.DoFBlurWithoutBokeh; + BlurThisDoF(cmd, dofDesc, ShaderParams.dofRT, (int)pass); + } + else { + BlurThisDoF(cmd, dofDesc, ShaderParams.dofRT, (int)Pass.DoFBlurWithoutBokeh); + + // separate & blend bokeh + cmd.GetTemporaryRT(ShaderParams.dofBokehRT, dofDesc, FilterMode.Bilinear); + FullScreenBlit(cmd, source, ShaderParams.dofBokehRT, bMat, (int)Pass.DoFBokeh); + BlurThisDoF(cmd, dofDesc, ShaderParams.dofBokehRT, (int)Pass.DoFBlurBokeh); + FullScreenBlit(cmd, ShaderParams.dofBokehRT, ShaderParams.dofRT, bMat, (int)Pass.DoFAdditive); + cmd.ReleaseTemporaryRT(ShaderParams.dofBokehRT); + } + + + cmd.SetGlobalTexture(ShaderParams.dofRT, ShaderParams.dofRT); + } + + static void BlurThisDoF (CommandBuffer cmd, RenderTextureDescriptor dofDesc, int rt, int renderPass) { + cmd.GetTemporaryRT(ShaderParams.dofTempBlurDoFTemp1RT, dofDesc, beautify.depthOfFieldFilterMode.value); + cmd.GetTemporaryRT(ShaderParams.dofTempBlurDoFTemp2RT, dofDesc, beautify.depthOfFieldFilterMode.value); + + UpdateDepthOfFieldBlurData(cmd, new Vector2(0.44721f, -0.89443f)); + FullScreenBlit(cmd, rt, ShaderParams.dofTempBlurDoFTemp1RT, bMat, renderPass); + + UpdateDepthOfFieldBlurData(cmd, new Vector2(-1f, 0f)); + FullScreenBlit(cmd, ShaderParams.dofTempBlurDoFTemp1RT, ShaderParams.dofTempBlurDoFTemp2RT, bMat, renderPass); + + UpdateDepthOfFieldBlurData(cmd, new Vector2(0.44721f, 0.89443f)); + FullScreenBlit(cmd, ShaderParams.dofTempBlurDoFTemp2RT, rt, bMat, renderPass); + + cmd.ReleaseTemporaryRT(ShaderParams.dofTempBlurDoFTemp2RT); + cmd.ReleaseTemporaryRT(ShaderParams.dofTempBlurDoFTemp1RT); + } + + + static void BlurThisAlpha (CommandBuffer cmd, RenderTextureDescriptor dofDesc, int rt, float blurScale = 1f) { + cmd.GetTemporaryRT(ShaderParams.dofTempBlurDoFAlphaRT, dofDesc, FilterMode.Bilinear); + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale); + FullScreenBlit(cmd, rt, ShaderParams.dofTempBlurDoFAlphaRT, bMat, (int)Pass.DoFBlurHorizontally); + FullScreenBlit(cmd, ShaderParams.dofTempBlurDoFAlphaRT, rt, bMat, (int)Pass.DoFBlurVertically); + cmd.ReleaseTemporaryRT(ShaderParams.dofTempBlurDoFAlphaRT); + } + + static void UpdateDepthOfFieldBlurData (CommandBuffer cmd, Vector2 blurDir) { + float downsamplingRatio = 1f / (float)beautify.depthOfFieldDownsampling.value; + blurDir *= downsamplingRatio; + camData.dofLastBokehData.z = blurDir.x; + camData.dofLastBokehData.w = blurDir.y; + cmd.SetGlobalVector(ShaderParams.dofBokehData, camData.dofLastBokehData); + } + + static void DoVignette () { + float outerRing = 1f - beautify.vignettingOuterRing.value; + float innerRing = 1f - beautify.vignettingInnerRing.value; + bool vignettingEnabled = outerRing < 1 || innerRing < 1f || beautify.vignettingFade.value > 0 || beautify.vignettingBlink.value > 0; + if (vignettingEnabled) { + Color vignettingColorAdjusted = beautify.vignettingColor.value; + float vb = 1f - beautify.vignettingBlink.value * 2f; + if (vb < 0) vb = 0; + vignettingColorAdjusted.r *= vb; + vignettingColorAdjusted.g *= vb; + vignettingColorAdjusted.b *= vb; + bMat.SetColor(ShaderParams.vignette, vignettingColorAdjusted); + Camera cam = cameraData.camera; + float vignetteAspect; + float vignetteData2 = 1f; + if (beautify.vignettingCircularShape.value && beautify.vignettingBlink.value <= 0) { + if (beautify.vignettingCircularShapeFitMode.value == VignetteFitMode.FitToWidth) { + vignetteAspect = 1.0f / cam.aspect; + } + else { + vignetteAspect = 1f; + vignetteData2 = cam.aspect; + } + } + else { + vignetteAspect = beautify.vignettingAspectRatio.value + 1.001f / (1.001f - beautify.vignettingBlink.value) - 1f; + } + Vector4 vignetteData = new Vector4(beautify.vignettingCenter.value.x, beautify.vignettingCenter.value.y, vignetteAspect, outerRing); + if (beautify.vignettingBlinkStyle.value == BlinkStyle.Human) { + vignetteData.y -= beautify.vignettingBlink.value * 0.5f; + } + bMat.SetVector(ShaderParams.vignetteData, vignetteData); + bMat.SetFloat(ShaderParams.vignetteData2, vignetteData2); + } + } + + static void DoEyeAdaptation (CommandBuffer cmd) { + + int rtEALength = rtEA.Length; + int sizeEA = (int)Mathf.Pow(2, rtEALength); + + RenderTextureDescriptor eaDesc = sourceDescHP; + for (int k = 0; k < rtEALength; k++) { + eaDesc.width = eaDesc.height = sizeEA; + cmd.GetTemporaryRT(rtEA[k], eaDesc, FilterMode.Bilinear); + sizeEA /= 2; + } + + FullScreenBlit(cmd, source, rtEA[0], bMat, (int)Pass.CopyBilinear); + + int lumRT = rtEALength - 1; + for (int k = 0; k < lumRT; k++) { + FullScreenBlit(cmd, rtEA[k], rtEA[k + 1], bMat, k == 0 ? (int)Pass.ComputeScreenLum : (int)Pass.DownsampleScreenLum); + } + cmd.SetGlobalTexture(ShaderParams.eaLumSrc, rtEA[lumRT]); + bool firstBlend = false; + if (camData.rtEAacum == null) { + RenderTextureDescriptor rtEASmallDesc = sourceDescHP; + rtEASmallDesc.width = rtEASmallDesc.height = 2; + rtEASmallDesc.colorFormat = RenderTextureFormat.ARGBFloat; + camData.rtEAacum = new RenderTexture(rtEASmallDesc); + camData.rtEAacum.Create(); + camData.rtEAHist = new RenderTexture(rtEASmallDesc); + camData.rtEAHist.Create(); + firstBlend = true; + } + if (firstBlend || Time.timeSinceLevelLoad < 0.5f) { + FullScreenBlit(cmd, rtEA[lumRT], camData.rtEAacum, bMat, (int)Pass.CopyExact); + FullScreenBlit(cmd, camData.rtEAacum, camData.rtEAHist, bMat, (int)Pass.CopyExact); + } + else { + FullScreenBlit(cmd, rtEA[lumRT], camData.rtEAacum, bMat, (int)Pass.BlendScreenLum); + FullScreenBlit(cmd, camData.rtEAacum, camData.rtEAHist, bMat, (int)Pass.SimpleBlendLum); + } + cmd.SetGlobalTexture(ShaderParams.eaHist, camData.rtEAHist); + } + + static void DoSeparateOutline (CommandBuffer cmd) { + RenderTextureDescriptor rtOutlineDescriptor = sourceDesc; + rtOutlineDescriptor.colorFormat = supportsR8Format ? RenderTextureFormat.R8 : sourceDesc.colorFormat; + cmd.GetTemporaryRT(ShaderParams.outlineRT, rtOutlineDescriptor); + FullScreenBlit(cmd, source, ShaderParams.outlineRT, bMat, (int)Pass.OutlineDetect); + int passCount = beautify.outlineBlurPassCount.value; + float spread = beautify.outlineSpread.value; + bool downscale = beautify.outlineBlurDownscale.value; + for (int k = 1; k <= passCount; k++) { + BlurThisOutline(cmd, rtOutlineDescriptor, spread, downscale ? k : 1); + } + FullScreenBlit(cmd, ShaderParams.outlineRT, source, bMat, (int)Pass.OutlineBlend); + cmd.ReleaseTemporaryRT(ShaderParams.outlineRT); + } + + static void BlurThisOutline (CommandBuffer cmd, RenderTextureDescriptor desc, float blurScale, int downscale) { + desc.width = desc.width / downscale; + desc.height = desc.height / downscale; + cmd.GetTemporaryRT(ShaderParams.tempBlurRT, desc, FilterMode.Bilinear); + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale); + FullScreenBlit(cmd, ShaderParams.outlineRT, ShaderParams.tempBlurRT, bMat, (int)Pass.OutlineBlurH); + float ratio = (float)desc.height / desc.width; + cmd.SetGlobalFloat(ShaderParams.blurScale, blurScale * ratio); + FullScreenBlit(cmd, ShaderParams.tempBlurRT, ShaderParams.outlineRT, bMat, (int)Pass.OutlineBlurV); + cmd.ReleaseTemporaryRT(ShaderParams.tempBlurRT); + } + + static Vector3 camPrevPos; + static Quaternion camPrevRotation; + static float currSens; + static bool canUseDepthTexture; + + public void UpdateMaterialProperties (Camera cam) { + + keywords.Clear(); + + // Compute motion sensibility + float sharpenIntensity = beautify.sharpenIntensity.value; + bool usesSharpen = sharpenIntensity > 0; + sharpenExclusionLayerMask = beautify.sharpenExclusionLayerMask.value; + // If exclusion mask is set to everything, disable sharpen + if (sharpenExclusionLayerMask == -1) { + usesSharpen = false; + sharpenExclusionLayerMask = 0; + } + + BeautifySettings.sharpenExclusionMask = sharpenExclusionLayerMask; + usesSharpenExclusionMask = usesSharpen && sharpenExclusionLayerMask != 0; + + if (usesSharpen) { + float tempSharpen = sharpenIntensity; + float sensibility = beautify.sharpenMotionSensibility.value; + if (sensibility > 0) { + + // Motion sensibility v2 + Vector3 pos = cam.transform.position; + Quaternion q = cam.transform.rotation; + + float dt = Time.deltaTime; + if (pos != camPrevPos || q.x != camPrevRotation.x || q.y != camPrevRotation.y || q.z != camPrevRotation.z || q.w != camPrevRotation.w) { + currSens = Mathf.Lerp(currSens, sharpenIntensity * sensibility, 30f * sensibility * dt); + camPrevPos = pos; + camPrevRotation = q; + } + else { + currSens -= 30f * beautify.sharpenMotionRestoreSpeed.value * dt; + } + + currSens = Mathf.Clamp(currSens, 0, sharpenIntensity); + tempSharpen = sharpenIntensity - currSens; + } + bMat.SetVector(ShaderParams.sharpen, new Vector4(tempSharpen, canUseDepthTexture ? beautify.sharpenDepthThreshold.value + 0.000001f : 1f, beautify.sharpenClamp.value, beautify.sharpenRelaxation.value)); + + if (usesSharpenExclusionMask) { + keywords.Add(ShaderParams.SKW_SHARPEN_EXCLUSION_MASK); + } + else { + keywords.Add(ShaderParams.SKW_SHARPEN); + } + } + + + bool isOrtho = cam.orthographic; + bool linearColorSpace = QualitySettings.activeColorSpace == ColorSpace.Linear; + + bMat.SetVector(ShaderParams.colorParams, new Vector4(beautify.sepia.value, beautify.daltonize.value, (beautify.sharpenMinMaxDepth.value.x + beautify.sharpenMinMaxDepth.value.y) * 0.5f, Mathf.Abs(beautify.sharpenMinMaxDepth.value.y - beautify.sharpenMinMaxDepth.value.x) * 0.5f + (isOrtho ? 1000.0f : 0f))); + + float contrast = linearColorSpace ? 1.0f + (beautify.contrast.value - 1.0f) / 2.2f : beautify.contrast.value; + bMat.SetVector(ShaderParams.colorBoost, new Vector4(beautify.brightness.value, contrast, beautify.saturate.value, beautify.downsamplingMultiplier.value > 1f ? 0 : beautify.ditherIntensity.value)); + bMat.SetColor(ShaderParams.tintColor, beautify.tintColor.value); + + bMat.SetVector(ShaderParams.colorTemp, new Vector4(beautify.colorTemp.value, beautify.colorTempBlend.value, 0)); + + if (beautify.compareMode.value) { + float angle, panningValue; + switch (beautify.compareStyle.value) { + case CompareStyle.FreeAngle: + angle = beautify.compareLineAngle.value; + panningValue = -10; + break; + case CompareStyle.SameSide: + angle = Mathf.PI * 0.5f; + panningValue = beautify.comparePanning.value; + break; + default: + angle = Mathf.PI * 0.5f; + panningValue = -20f + beautify.comparePanning.value * 2f; + break; + } + bMat.SetVector(ShaderParams.compareParams, new Vector4(Mathf.Cos(angle), Mathf.Sin(angle), panningValue, beautify.compareLineWidth.value)); + } + + bMat.SetVector(ShaderParams.fxColor, new Color(beautify.tonemapExposurePre.value, beautify.tonemapBrightnessPost.value, beautify.tonemapMaxInputBrightness.value, beautify.lutIntensity.value)); + + // bloom related + usesBloomAndFlares = false; + BeautifySettings.bloomExcludeMask = 0; + BeautifySettings.anamorphicFlaresExcludeMask = 0; + bool sunFlareEnabled = false; + if (beautify.sunFlaresIntensity.value > 0) { + CheckSun(); + sunFlareEnabled = sceneSettings != null && sceneSettings.sun != null; + } + + if (beautify.lensDirtIntensity.value > 0 || beautify.bloomIntensity.value > 0 || beautify.anamorphicFlaresIntensity.value > 0 || sunFlareEnabled) { + + BeautifySettings.bloomExcludeMask = beautify.bloomIntensity.value > 0 && beautify.bloomExcludeLayers.value ? (int)beautify.bloomExclusionLayerMask.value : 0; + + float bloomWeightsSum = 0.00001f + beautify.bloomWeight0.value + beautify.bloomWeight1.value + beautify.bloomWeight2.value + beautify.bloomWeight3.value + beautify.bloomWeight4.value + beautify.bloomWeight5.value; + bMat.SetVector(ShaderParams.bloomWeights2, new Vector4(beautify.bloomWeight4.value / bloomWeightsSum + beautify.bloomBoost4.value, beautify.bloomWeight5.value / bloomWeightsSum + beautify.bloomBoost5.value, beautify.bloomMaxBrightness.value, bloomWeightsSum)); + if (beautify.bloomCustomize.value) { + bMat.SetColor(ShaderParams.bloomTint0, beautify.bloomTint0.value); + bMat.SetColor(ShaderParams.bloomTint1, beautify.bloomTint1.value); + bMat.SetColor(ShaderParams.bloomTint2, beautify.bloomTint2.value); + bMat.SetColor(ShaderParams.bloomTint3, beautify.bloomTint3.value); + bMat.SetColor(ShaderParams.bloomTint4, beautify.bloomTint4.value); + bMat.SetColor(ShaderParams.bloomTint5, beautify.bloomTint5.value); + } + bMat.SetColor(ShaderParams.bloomTint, beautify.bloomTint.value); + + float spread = Mathf.Lerp(0.05f, 0.95f, beautify.bloomSpread.value); + bMat.SetFloat(ShaderParams.bloomSpread, spread); + + UpdateMaterialBloomIntensityAndThreshold(); + if (beautify.bloomIntensity.value > 0 || (beautify.lensDirtIntensity.value > 0 && beautify.anamorphicFlaresIntensity.value <= 0)) { + bMat.SetVector(ShaderParams.bloomWeights, new Vector4(beautify.bloomWeight0.value / bloomWeightsSum + beautify.bloomBoost0.value, beautify.bloomWeight1.value / bloomWeightsSum + beautify.bloomBoost1.value, beautify.bloomWeight2.value / bloomWeightsSum + beautify.bloomBoost2.value, beautify.bloomWeight3.value / bloomWeightsSum + beautify.bloomBoost3.value)); + if (canUseDepthTexture) { + if (beautify.bloomDepthAtten.value > 0 || beautify.bloomNearAtten.value > 0) { + keywords.Add(ShaderParams.SKW_BLOOM_USE_DEPTH); + bMat.SetFloat(ShaderParams.bloomDepthThreshold, beautify.bloomDepthAtten.value); + bMat.SetFloat(ShaderParams.bloomNearThreshold, (beautify.bloomNearAtten.value / cam.farClipPlane) + 0.00001f); + } + if (BeautifySettings.bloomExcludeMask != 0) { + if (beautify.bloomLayersFilterMethod.value == BloomLayersFilterMethod.ExcludeSelectedLayers) { + keywords.Add(ShaderParams.SKW_BLOOM_USE_LAYER); + } + else { + keywords.Add(ShaderParams.SKW_BLOOM_USE_LAYER_INCLUSION); + } + } + } + if (beautify.bloomConservativeThreshold.value) { + keywords.Add(ShaderParams.SKW_BLOOM_PROP_THRESHOLDING); + } + } + keywords.Add(ShaderParams.SKW_BLOOM); + usesBloomAndFlares = true; + + if (beautify.lensDirtIntensity.value > 0) { + Vector4 dirtData = new Vector4(1.0f, beautify.lensDirtIntensity.value * beautify.lensDirtIntensity.value, beautify.lensDirtThreshold.value, Mathf.Max(beautify.bloomIntensity.value, 1f)); + bMat.SetVector(ShaderParams.dirt, dirtData); + Texture tex = beautify.lensDirtTexture.value; + if (tex == null) { + if (dirtTexture == null) { + dirtTexture = Resources.Load("Textures/lensDirt") as Texture2D; + } + tex = dirtTexture; + } + if (tex != null) { + bMat.SetTexture(ShaderParams.dirtTex, tex); + keywords.Add(ShaderParams.SKW_DIRT); + } + } + } + + // anamorphic flares related + if (beautify.anamorphicFlaresIntensity.value > 0) { + + usesBloomAndFlares = true; + if (canUseDepthTexture) { + if (beautify.anamorphicFlaresDepthAtten.value > 0 || beautify.anamorphicFlaresNearAtten.value > 0) { + keywords.Add(ShaderParams.SKW_ANAMORPHIC_FLARES_USE_DEPTH); + bMat.SetFloat(ShaderParams.afDepthThreshold, beautify.anamorphicFlaresDepthAtten.value); + bMat.SetFloat(ShaderParams.afNearThreshold, (beautify.anamorphicFlaresNearAtten.value / cam.farClipPlane) + 0.00001f); + } + BeautifySettings.anamorphicFlaresExcludeMask = beautify.anamorphicFlaresExcludeLayers.value ? (int)beautify.anamorphicFlaresExclusionLayerMask.value : 0; + if (BeautifySettings.anamorphicFlaresExcludeMask != 0) { + if (beautify.anamorphicFlaresLayersFilterMethod.value == BloomLayersFilterMethod.ExcludeSelectedLayers) { + keywords.Add(ShaderParams.SKW_ANAMORPHIC_FLARES_USE_LAYER); + } + else { + keywords.Add(ShaderParams.SKW_ANAMORPHIC_FLARES_USE_LAYER_INCLUSION); + } + } + } + + if (beautify.anamorphicFlaresConservativeThreshold.value) { + keywords.Add(ShaderParams.SKW_ANAMORPHIC_PROP_THRESHOLDING); + } + bMat.SetColor(ShaderParams.afTintColor, beautify.anamorphicFlaresTint.value); + } + + // sun flares related + if (sunFlareEnabled) { + usesBloomAndFlares = true; + bMat.SetVector(ShaderParams.sfSunData, new Vector4(beautify.sunFlaresSunIntensity.value, beautify.sunFlaresSunDiskSize.value, beautify.sunFlaresSunRayDiffractionIntensity.value, beautify.sunFlaresSunRayDiffractionThreshold.value)); + bMat.SetVector(ShaderParams.sfCoronaRays1, new Vector4(beautify.sunFlaresCoronaRays1Length.value, Mathf.Max(beautify.sunFlaresCoronaRays1Streaks.value / 2f, 1), Mathf.Max(beautify.sunFlaresCoronaRays1Spread.value, 0.0001f), beautify.sunFlaresCoronaRays1AngleOffset.value)); + bMat.SetVector(ShaderParams.sfCoronaRays2, new Vector4(beautify.sunFlaresCoronaRays2Length.value, Mathf.Max(beautify.sunFlaresCoronaRays2Streaks.value / 2f, 1), Mathf.Max(beautify.sunFlaresCoronaRays2Spread.value, 0.0001f), beautify.sunFlaresCoronaRays2AngleOffset.value)); + if (canUseDepthTexture) { + SunFlaresDepthOcclusionMode occlusionMode = beautify.sunFlaresDepthOcclusionMode.value; + if (occlusionMode == SunFlaresDepthOcclusionMode.Simple) { + keywords.Add(ShaderParams.SKW_SUN_FLARES_OCCLUSION_SIMPLE); + } + else if (occlusionMode == SunFlaresDepthOcclusionMode.Smooth) { + keywords.Add(ShaderParams.SKW_SUN_FLARES_OCCLUSION_SMOOTH); + bMat.SetFloat(ShaderParams.sfOcclusionThreshold, beautify.sunFlaresDepthOcclusionThreshold.value); + } + } +#if UNITY_2020_3_OR_NEWER + +#if ENABLE_VR && ENABLE_XR_MODULE + if (!cameraData.xrRendering) +#endif + { + keywords.Add(ShaderParams.SKW_SUN_FLARES_USE_GHOSTS); + bMat.SetVector(ShaderParams.sfGhosts1, new Vector4(0, beautify.sunFlaresGhosts1Size.value, beautify.sunFlaresGhosts1Offset.value, beautify.sunFlaresGhosts1Brightness.value)); + bMat.SetVector(ShaderParams.sfGhosts2, new Vector4(0, beautify.sunFlaresGhosts2Size.value, beautify.sunFlaresGhosts2Offset.value, beautify.sunFlaresGhosts2Brightness.value)); + bMat.SetVector(ShaderParams.sfGhosts3, new Vector4(0, beautify.sunFlaresGhosts3Size.value, beautify.sunFlaresGhosts3Offset.value, beautify.sunFlaresGhosts3Brightness.value)); + bMat.SetVector(ShaderParams.sfGhosts4, new Vector4(0, beautify.sunFlaresGhosts4Size.value, beautify.sunFlaresGhosts4Offset.value, beautify.sunFlaresGhosts4Brightness.value)); + bMat.SetVector(ShaderParams.sfHalo, new Vector4(beautify.sunFlaresHaloOffset.value, beautify.sunFlaresHaloAmplitude.value, beautify.sunFlaresHaloIntensity.value * 100f, 0)); + } +#else + if (sourceDesc.vrUsage == VRTextureUsage.None) { + keywords.Add(ShaderParams.SKW_SUN_FLARES_USE_GHOSTS); + bMat.SetVector(ShaderParams.sfGhosts1, new Vector4(0, beautify.sunFlaresGhosts1Size.value, beautify.sunFlaresGhosts1Offset.value, beautify.sunFlaresGhosts1Brightness.value)); + bMat.SetVector(ShaderParams.sfGhosts2, new Vector4(0, beautify.sunFlaresGhosts2Size.value, beautify.sunFlaresGhosts2Offset.value, beautify.sunFlaresGhosts2Brightness.value)); + bMat.SetVector(ShaderParams.sfGhosts3, new Vector4(0, beautify.sunFlaresGhosts3Size.value, beautify.sunFlaresGhosts3Offset.value, beautify.sunFlaresGhosts3Brightness.value)); + bMat.SetVector(ShaderParams.sfGhosts4, new Vector4(0, beautify.sunFlaresGhosts4Size.value, beautify.sunFlaresGhosts4Offset.value, beautify.sunFlaresGhosts4Brightness.value)); + bMat.SetVector(ShaderParams.sfHalo, new Vector4(beautify.sunFlaresHaloOffset.value, beautify.sunFlaresHaloAmplitude.value, beautify.sunFlaresHaloIntensity.value * 100f, 0)); + } +#endif + if (flareTex == null) { + flareTex = Resources.Load("Textures/flareNoise") as Texture2D; + } + bMat.SetTexture(ShaderParams.sfFlareTex, flareTex); + } + + + // DoF + usesDepthOfField = false; + BeautifySettings.dofTransparentSupport = false; + BeautifySettings.dofAlphaTestSupport = false; + if (canUseDepthTexture && beautify.depthOfField.value) { + usesDepthOfField = true; + bool transparentSupport = beautify.depthOfFieldTransparentSupport.value && beautify.depthOfFieldTransparentLayerMask.value > 0; + bool alphaTestSupport = beautify.depthOfFieldAlphaTestSupport.value && beautify.depthOfFieldAlphaTestLayerMask.value > 0; + if (transparentSupport || alphaTestSupport) { + keywords.Add(ShaderParams.SKW_DEPTH_OF_FIELD_TRANSPARENT); + BeautifySettings.dofTransparentSupport = transparentSupport; + if (alphaTestSupport) { + BeautifySettings.dofAlphaTestSupport = true; + BeautifySettings.dofAlphaTestLayerMask = beautify.depthOfFieldAlphaTestLayerMask.value; + BeautifySettings.dofAlphaTestDoubleSided = beautify.depthOfFieldAlphaTestDoubleSided.value; + } + } + else { + keywords.Add(ShaderParams.SKW_DEPTH_OF_FIELD); + } + } + + // Vignette + usesVignetting = false; + float innerRing = 1f - beautify.vignettingInnerRing.value; + float outerRing = 1f - beautify.vignettingOuterRing.value; + usesVignetting = outerRing < 1 || innerRing < 1f || beautify.vignettingFade.value > 0 || beautify.vignettingBlink.value > 0; + if (innerRing >= outerRing) { + innerRing = outerRing - 0.0001f; + } + if (usesVignetting) { + if (beautify.vignettingMask.value != null) { + bMat.SetTexture(ShaderParams.vignetteMask, beautify.vignettingMask.value); + keywords.Add(ShaderParams.SKW_VIGNETTING_MASK); + } + else { + keywords.Add(ShaderParams.SKW_VIGNETTING); + } + } + + // Frame + if (beautify.frame.value) { + keywords.Add(ShaderParams.SKW_FRAME); + Color frameColorAdjusted = beautify.frameColor.value; + if (beautify.frameMask.value != null) { + bMat.SetTexture(ShaderParams.frameMask, beautify.frameMask.value); + } + else { + bMat.SetTexture(ShaderParams.frameMask, Texture2D.whiteTexture); + } + if (beautify.frameStyle.value == FrameStyle.Border) { + bMat.SetColor(ShaderParams.frameColor, frameColorAdjusted); + bMat.SetVector(ShaderParams.frameData, new Vector4(beautify.frameThickness.value, beautify.frameSharpness.value, 0, 0)); + } + else { + bMat.SetColor(ShaderParams.frameColor, Color.black); + bMat.SetVector(ShaderParams.frameData, new Vector4(0.5f - beautify.frameBandHorizontalSize.value, 1f / (0.0001f + beautify.frameBandHorizontalSmoothness.value), 0.5f - beautify.frameBandVerticalSize.value, 1f / (0.0001f + beautify.frameBandVerticalSmoothness.value))); + } + } + + // Purkinje and vignetting data + bool usesPurkinje = beautify.purkinje.value; + if (usesPurkinje || usesVignetting) { + float vd = beautify.vignettingFade.value + beautify.vignettingBlink.value * 0.5f; + if (beautify.vignettingBlink.value > 0.99f) vd = 1f; + Vector4 purkinjeData = new Vector4(beautify.purkinjeAmount.value, beautify.purkinjeLuminanceThreshold.value, vd, innerRing); + bMat.SetVector(ShaderParams.purkinje, purkinjeData); + if (beautify.purkinje.value) { + keywords.Add(ShaderParams.SKW_PURKINJE); + } + } + + // Eye adaptation + bool usesEyeAdaptation = beautify.eyeAdaptation.value; + requiresLuminanceComputation = Application.isPlaying && (usesEyeAdaptation || usesPurkinje); + if (requiresLuminanceComputation) { + Vector4 eaData = new Vector4(beautify.eyeAdaptationMinExposure.value, beautify.eyeAdaptationMaxExposure.value, beautify.eyeAdaptationSpeedToDark.value, beautify.eyeAdaptationSpeedToLight.value); + bMat.SetVector(ShaderParams.eaParams, eaData); + if (usesEyeAdaptation) { + bMat.SetVector(ShaderParams.eaParams2, new Vector4(beautify.eyeAdaptationCenterWeight.value, beautify.eyeAdaptationMinCameraDistance.value, beautify.eyeAdaptationMiddleGray.value, 0f)); + keywords.Add(ShaderParams.SKW_EYE_ADAPTATION); + if (beautify.eyeAdaptationMinCameraDistance.value > 0) { + keywords.Add(ShaderParams.SKW_EA_USE_DEPTH); + } + else if (beautify.eyeAdaptationMeteringMode.value == EyeAdaptationMeteringMode.Mask) { + Texture eaMask = beautify.eyeAdaptationMask.value; + if (eaMask != null) { + bMat.SetTexture(ShaderParams.eaMask, eaMask); + keywords.Add(ShaderParams.SKW_EA_USE_MASK); + } + } + } + } + + // Outline + usesSeparateOutline = false; + BeautifySettings.outlineDepthPrepass = false; + BeautifySettings.outlineDepthPrepassUseOptimizedShader = false; + BeautifySettings.outlineUseObjectId = false; + if (canUseDepthTexture) { + bool useOutlinePerObjectId = beautify.outlineTechnique.value == OutlineTechnique.PerObjectId; + if (useOutlinePerObjectId) { + beautify.outlineCustomize.Override(true); + beautify.outlineUsesOptimizedShader.Override(true); + } + if (beautify.outline.value) { + usesSeparateOutline = beautify.outlineCustomize.value; + float outlineDistanceFade = 1; + if (usesSeparateOutline) { + bool useOptimizedShader = beautify.outlineUsesOptimizedShader.value; + BeautifySettings.outlineUseObjectId = useOutlinePerObjectId; + if (beautify.outlineLayerMask.value != -1 || useOutlinePerObjectId) { + BeautifySettings.outlineDepthPrepass = true; + BeautifySettings.outlineDepthPrepassUseOptimizedShader = useOptimizedShader; + BeautifySettings.outlineLayerMask = beautify.outlineLayerMask.value; +#if UNITY_2022_3_OR_NEWER + BeautifySettings.outlineLayerCutOff = beautify.outlineLayerCutOff.value; +#endif + if (useOutlinePerObjectId) { + keywords.Add(ShaderParams.SKW_OUTLINE_OBJECT_ID); + } + else { + keywords.Add(ShaderParams.SKW_OUTLINE_CUSTOM_DEPTH); + } + } + outlineDistanceFade = beautify.outlineDistanceFade.value / cam.farClipPlane; + if (outlineDistanceFade > 0) { + keywords.Add(ShaderParams.SKW_OUTLINE_DEPTH_FADE); + } + } + else { + keywords.Add(ShaderParams.SKW_OUTLINE); + } + float outlineZParam; + if (useOutlinePerObjectId) { + outlineZParam = beautify.outlineMinSeparation.value; + if (outlineZParam > 1f) { + keywords.Add(ShaderParams.SKW_OUTLINE_MIN_SEPARATION); + } + if (beautify.outlineOuterOnly.value) { + keywords.Add(ShaderParams.SKW_OUTLINE_OUTER_ONLY); + } + } + else { + outlineZParam = beautify.outlineMinDepthThreshold.value; + } + bMat.SetVector(ShaderParams.outlineData, new Vector4(beautify.outlineIntensityMultiplier.value, outlineDistanceFade, outlineZParam, beautify.outlineSaturationDiffThreshold.value)); + Color color = beautify.outlineColor.value; + color.a = 1f - beautify.outlineThreshold.value; + bMat.SetColor(ShaderParams.outline, color); + } + else { + // edge AA related - only apply if outline is not used + float aaStrength = beautify.antialiasStrength.value; + if (aaStrength > 0) { + bMat.SetVector(ShaderParams.edgeAntialiasing, new Vector4(aaStrength, beautify.antialiasDepthThreshold.value, beautify.antialiasDepthAttenuation.value * 10f, beautify.antialiasSpread.value)); + keywords.Add(ShaderParams.SKW_EDGE_ANTIALIASING); + } + } + } + + // Color tweaks + if (beautify.sepia.value > 0 || beautify.daltonize.value > 0 || beautify.colorTempBlend.value > 0) { + keywords.Add(ShaderParams.SKW_COLOR_TWEAKS); + } + + // ACES Tonemapping + if (beautify.tonemap.value == TonemapOperator.ACES) { + keywords.Add(ShaderParams.SKW_TONEMAP_ACES); + } + else if (beautify.tonemap.value == TonemapOperator.ACESFitted) { + keywords.Add(ShaderParams.SKW_TONEMAP_ACES_FITTED); + } + else if (beautify.tonemap.value == TonemapOperator.AGX) { + bMat.SetFloat(ShaderParams.tonemapAGXGamma, linearColorSpace ? beautify.tonemapAGXGamma.value : beautify.tonemapAGXGamma.value * 0.5f); + keywords.Add(ShaderParams.SKW_TONEMAP_AGX); + } + + // LUT or Nightvision + Texture lutTex = beautify.lutTexture.value; + bool hasLut = beautify.lut.value && beautify.lutIntensity.value > 0 && lutTex != null; + bool hasLut3D = hasLut && lutTex is Texture3D; + + if (hasLut || hasLut3D) { + if (hasLut3D) { + bMat.SetTexture(ShaderParams.lut3DTexture, lutTex); + float x = 1f / lutTex.width; + float y = lutTex.width - 1f; + bMat.SetVector(ShaderParams.lut3DParams, new Vector4(x * 0.5f, x * y, 0, 0)); + keywords.Add(ShaderParams.SKW_LUT3D); + } + else { + bMat.SetTexture(ShaderParams.lutTex, beautify.lutTexture.value); + keywords.Add(ShaderParams.SKW_LUT); + } + } + else if (beautify.nightVision.value) { + keywords.Add(ShaderParams.SKW_NIGHT_VISION); + Color nightVisionAdjusted = beautify.nightVisionColor.value; + if (linearColorSpace) { + nightVisionAdjusted.a *= 5.0f * nightVisionAdjusted.a; + } + else { + nightVisionAdjusted.a *= 3.0f * nightVisionAdjusted.a; + } + nightVisionAdjusted.r *= nightVisionAdjusted.a; + nightVisionAdjusted.g *= nightVisionAdjusted.a; + nightVisionAdjusted.b *= nightVisionAdjusted.a; + bMat.SetColor(ShaderParams.nightVision, nightVisionAdjusted); + bMat.SetVector(ShaderParams.nightVisionDepth, new Vector4(beautify.nightVisionDepth.value, beautify.nightVisionDepthFallOff.value, 0, 0)); + } + else if (beautify.thermalVision.value) { + keywords.Add(ShaderParams.SKW_THERMAL_VISION); + bMat.SetColor(ShaderParams.nightVision, new Color(0, 0, beautify.thermalVisionDistortionAmount.value / 10000f, beautify.thermalVisionScanLines.value ? 0.4f : -1)); + } + + // Best performance mode + if (beautify.turboMode.value) { + keywords.Add(ShaderParams.SKW_TURBO); + } + + // Chromatic Aberration + if (beautify.chromaticAberrationIntensity.value > 0f) { + bMat.SetVector(ShaderParams.chromaticAberrationData, new Vector4(beautify.chromaticAberrationIntensity.value, beautify.chromaticAberrationSmoothing.value, beautify.chromaticAberrationShift.value, 0)); + if (!beautify.depthOfField.value) { + keywords.Add(ShaderParams.SKW_CHROMATIC_ABERRATION); + } + } + + // Final blur mask + if (beautify.blurIntensity.value > 0 && beautify.blurMask.value != null) { + bMat.SetTexture(ShaderParams.blurMask, beautify.blurMask.value); + } + + // Film grain + if (beautify.filmGrainEnabled.value) { + keywords.Add(ShaderParams.SKW_FILM_GRAIN); + // Make film grain resolution independent by scaling inversely with screen resolution + float resolutionScale = 1920f / cam.pixelWidth; // Use 1920 as reference resolution + float adjustedResolution = beautify.filmGrainResolution.value * resolutionScale; + bMat.SetVector(ShaderParams.filmGrainData, new Vector4( + beautify.filmGrainIntensity.value, + beautify.filmGrainLumaAttenuation.value, + adjustedResolution, + 0 + )); + float dirtSpotsIntensity = beautify.filmGrainDirtSpotsIntensity.value; + float filmScrachesAmount = 1f - beautify.filmGrainScratchesAmount.value * 0.05f; + float filmScrachesIntensity = beautify.filmGrainScratchesIntensity.value; + bMat.SetVector(ShaderParams.filmArtifactsData, new Vector4( + dirtSpotsIntensity > 0 ? 1f - beautify.filmGrainDirtSpotsAmount.value * 0.1f : 0, + dirtSpotsIntensity, + filmScrachesIntensity > 0 ? filmScrachesAmount : 0, + filmScrachesIntensity + )); + } + else + // Dither + if (beautify.ditherIntensity.value > 0f) { + keywords.Add(ShaderParams.SKW_DITHER); + } + + + int keywordsCount = keywords.Count; + if (keywordsArray == null || keywordsArray.Length < keywordsCount) { + keywordsArray = new string[keywordsCount]; + } + int keywordsArrayLength = keywordsArray.Length; + for (int k = 0; k < keywordsArrayLength; k++) { + if (k < keywordsCount) { + keywordsArray[k] = keywords[k]; + } + else { + keywordsArray[k] = ""; + } + } + bMat.shaderKeywords = keywordsArray; + } + + + + static void UpdateMaterialBloomIntensityAndThreshold () { + float bloomThreshold = beautify.bloomThreshold.value; + float anamorphicThreshold = beautify.anamorphicFlaresThreshold.value; + if (QualitySettings.activeColorSpace == ColorSpace.Linear) { + bloomThreshold *= bloomThreshold; + anamorphicThreshold *= anamorphicThreshold; + } + float anamorphicFlaresIntensity = beautify.turboMode.value ? beautify.anamorphicFlaresIntensity.value * 2f : beautify.anamorphicFlaresIntensity.value; + float bloomIntensity = beautify.turboMode.value ? beautify.bloomIntensity.value * 2f : beautify.bloomIntensity.value; + if (anamorphicFlaresIntensity > 0) { + float intensity = anamorphicFlaresIntensity / (bloomIntensity + 0.0001f); + bMat.SetVector(ShaderParams.afData, new Vector4(intensity, anamorphicThreshold, 0, beautify.anamorphicFlaresMaxBrightness.value)); + } + Vector4 b4 = new Vector4(bloomIntensity + (anamorphicFlaresIntensity > 0 ? 0.0001f : 0f), 0, 0, bloomThreshold); + bMat.SetVector(ShaderParams.bloom, b4); + } + + static void UpdateDepthOfFieldData (CommandBuffer cmd) { + // TODO: get focal length from camera FOV: FOV = 2 arctan (x/2f) x = diagonal of film (0.024mm) + if (!CheckSceneSettings()) return; + Camera cam = cameraData.camera; + float d = beautify.depthOfFieldDistance.value; + switch ((int)beautify.depthOfFieldFocusMode.value) { + case (int)DoFFocusMode.AutoFocus: + UpdateDoFAutofocusDistance(cam); + d = camData.dofLastAutofocusDistance; + break; + case (int)DoFFocusMode.FollowTarget: + if (sceneSettings.depthOfFieldTarget != null) { + Vector3 spos = cam.WorldToViewportPoint(sceneSettings.depthOfFieldTarget.position); + if (spos.z < 0 || spos.x < 0 || spos.x > 1 || spos.y < 0 || spos.y > 1) { + switch (beautify.depthOfFieldTargetFallback.value) { + case DoFTargetFallback.SwitchToAutofocus: + UpdateDoFAutofocusDistance(cam); + d = camData.dofLastAutofocusDistance; + break; + case DoFTargetFallback.FixedDistanceFocus: + d = beautify.depthOfFieldTargetFallbackFixedDistance.value; + break; + default: + d = camData.dofPrevDistance; + break; + } + } + else { + d = Vector3.Distance(cam.transform.position, sceneSettings.depthOfFieldTarget.position); + d = Mathf.Clamp(d, beautify.depthOfFieldAutofocusMinDistance.value, beautify.depthOfFieldAutofocusMaxDistance.value); + } + } + break; + } + + if (sceneSettings.OnBeforeFocus != null) { + d = sceneSettings.OnBeforeFocus(d); + } + camData.dofPrevDistance = Mathf.Lerp(camData.dofPrevDistance, d, Application.isPlaying ? beautify.depthOfFieldFocusSpeed.value * Time.unscaledDeltaTime * 30f : 1f); + float dofCoc; + if (beautify.depthOfFieldCameraSettings.value == Beautify.DoFCameraSettings.Real) { + float focalLength, fStop, imageSensorHeight; + + if (beautify.depthOfFieldUsePhysicalCamera.value && cam.usePhysicalProperties) { + // Use physical camera properties + focalLength = cam.focalLength; +#if UNITY_2022_1_OR_NEWER + fStop = cam.aperture; +#else + fStop = beautify.depthOfFieldFStop.value; +#endif + imageSensorHeight = cam.sensorSize.y; + } + else { + // Use Beautify settings + focalLength = beautify.depthOfFieldFocalLengthReal.value; + fStop = beautify.depthOfFieldFStop.value; + imageSensorHeight = beautify.depthOfFieldImageSensorHeight.value; + } + float aperture = focalLength / fStop; + dofCoc = aperture * (focalLength / Mathf.Max(camData.dofPrevDistance * 1000f - focalLength, 0.001f)) * (1f / imageSensorHeight) * cam.pixelHeight; + } + else { + // focal length in meters; aperture in mm + dofCoc = beautify.depthOfFieldAperture.value * (beautify.depthOfFieldFocalLength.value / Mathf.Max(camData.dofPrevDistance - beautify.depthOfFieldFocalLength.value, 0.001f)) * (1f / 0.024f); + } + float cocMultiplier = beautify.depthOfFieldResolutionInvariant.value ? cam.pixelWidth / 1920f : 1f; + camData.dofLastBokehData = new Vector4(camData.dofPrevDistance, dofCoc * cocMultiplier, 0, 0); + cmd.SetGlobalVector(ShaderParams.dofBokehData, camData.dofLastBokehData); + bMat.SetVector(ShaderParams.dofBokehData2, new Vector4(beautify.depthOfFieldForegroundBlur.value ? beautify.depthOfFieldForegroundDistance.value : cam.farClipPlane, beautify.depthOfFieldMaxSamples.value, beautify.depthOfFieldBokehThreshold.value, beautify.depthOfFieldBokehIntensity.value * beautify.depthOfFieldBokehIntensity.value)); + bMat.SetVector(ShaderParams.dofBokehData3, new Vector4(beautify.depthOfFieldMaxBrightness.value, beautify.depthOfFieldMaxDistance.value * (cam.farClipPlane + 1f), beautify.depthOfFieldMaxBlurRadius.value, 0)); + } + + + static void UpdateDoFAutofocusDistance (Camera cam) { + Vector3 p = beautify.depthOfFieldAutofocusViewportPoint.value; + p.z = 10f; + Ray r = cam.ViewportPointToRay(p); + if (Physics.Raycast(r, out RaycastHit hit, cam.farClipPlane, beautify.depthOfFieldAutofocusLayerMask.value)) { + // we don't use hit.distance as ray origin has a small shift from camera + float distance = Vector3.Distance(cam.transform.position, hit.point); + distance += beautify.depthOfFieldAutofocusDistanceShift.value; + camData.dofLastAutofocusDistance = distance; + } + else { + camData.dofLastAutofocusDistance = cam.farClipPlane; + } + camData.dofLastAutofocusDistance = Mathf.Clamp(camData.dofLastAutofocusDistance, beautify.depthOfFieldAutofocusMinDistance.value, beautify.depthOfFieldAutofocusMaxDistance.value); + BeautifySettings.depthOfFieldCurrentFocalPointDistance = camData.dofLastAutofocusDistance; + } + + + // Scene dependant settings + static BeautifySettings sceneSettings; + + static void CheckSun () { + + if (!CheckSceneSettings()) return; + + // Fetch a valid Sun reference + if (sceneSettings.sun == null) { + if (RenderSettings.sun != null) { + sceneSettings.sun = RenderSettings.sun.transform; + } + } + if (sceneSettings.sun == null) { +#if UNITY_2023_1_OR_NEWER + Light[] lights = FindObjectsByType(FindObjectsSortMode.None); +#else + Light[] lights = FindObjectsOfType(); +#endif + for (int k = 0; k < lights.Length; k++) { + Light light = lights[k]; + if (light.type == LightType.Directional && light.isActiveAndEnabled) { + sceneSettings.sun = light.transform; + break; + } + } + } + } + + static bool CheckSceneSettings () { + sceneSettings = BeautifySettings.instance; + return sceneSettings != null; + } + + } + + + class BeautifySharpenExclusionMaskPass : ScriptableRenderPass { + + static readonly List m_ShaderTagIdList = new List(); + + const string sharpenExclusionMaskRT = "_SharpenExclusionMask"; + static int sharpenExclusionMaskId = Shader.PropertyToID(sharpenExclusionMaskRT); + RTHandle maskRT; + static bool canUse16Bit; + + public BeautifySharpenExclusionMaskPass () { + RenderTargetIdentifier rti = new RenderTargetIdentifier(sharpenExclusionMaskRT, 0, CubemapFace.Unknown, -1); + maskRT = RTHandles.Alloc(rti, name: sharpenExclusionMaskRT); + renderPassEvent = RenderPassEvent.AfterRenderingOpaques; + m_ShaderTagIdList.Clear(); + m_ShaderTagIdList.Add(new ShaderTagId("SRPDefaultUnlit")); + m_ShaderTagIdList.Add(new ShaderTagId("UniversalForward")); + m_ShaderTagIdList.Add(new ShaderTagId("LightweightForward")); + m_ShaderTagIdList.Add(new ShaderTagId("Universal2D")); + canUse16Bit = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGB565); + } + +#if UNITY_2022_2_OR_NEWER + RTHandle depthRT; +#else + RenderTargetIdentifier depthRT; +#endif + + +#if UNITY_2022_1_OR_NEWER + public void SetupRenderTargets(ScriptableRenderer renderer) { +#if UNITY_2022_2_OR_NEWER +#pragma warning disable CS0618 + depthRT = renderer.cameraDepthTargetHandle; +#pragma warning restore CS0618 +#else + depthRT = renderer.cameraDepthTarget; +#endif + } +#else + public override void OnCameraSetup (CommandBuffer cmd, ref RenderingData renderingData) { + depthRT = renderingData.cameraData.renderer.cameraDepthTarget; + } +#endif + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Configure (CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { + RenderTextureDescriptor maskDesc = cameraTextureDescriptor; + maskDesc.colorFormat = canUse16Bit ? RenderTextureFormat.RGB565 : RenderTextureFormat.ARGB32; + maskDesc.depthBufferBits = 0; + cmd.GetTemporaryRT(sharpenExclusionMaskId, maskDesc, FilterMode.Point); + cmd.SetGlobalTexture(sharpenExclusionMaskRT, sharpenExclusionMaskId); + ConfigureTarget(maskRT, depthRT); + ConfigureClear(ClearFlag.Color, Color.black); + } + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Execute (ScriptableRenderContext context, ref RenderingData renderingData) { + + SortingCriteria sortingCriteria = SortingCriteria.None; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, ref renderingData, sortingCriteria); + var filter = new FilteringSettings(RenderQueueRange.all) { layerMask = BeautifySettings.sharpenExclusionMask }; +#if UNITY_2023_1_OR_NEWER + CommandBuffer cmd = CommandBufferPool.Get("Beautify Sharpen Exclusion Mask"); + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + RendererList list = context.CreateRendererList(ref listParams); + cmd.DrawRendererList(list); + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); +#else + context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref filter); +#endif + } + +#if UNITY_2023_3_OR_NEWER + class PassData { + public TextureHandle depthTexture; + public RendererListHandle rendererListHandle; + public UniversalCameraData cameraData; + } + + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { + + using (var builder = renderGraph.AddUnsafePass("Beautify Sharpen Exclusion Mask Pass", out var passData)) { + + builder.AllowPassCulling(false); + + UniversalResourceData resourceData = frameData.Get(); + UniversalRenderingData renderingData = frameData.Get(); + UniversalLightData lightData = frameData.Get(); + UniversalCameraData cameraData = frameData.Get(); + passData.depthTexture = resourceData.activeDepthTexture; + passData.cameraData = cameraData; + + SortingCriteria sortingCriteria = SortingCriteria.None; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, renderingData, cameraData, lightData, sortingCriteria); + var filter = new FilteringSettings(RenderQueueRange.all) { layerMask = BeautifySettings.sharpenExclusionMask }; + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + passData.rendererListHandle = renderGraph.CreateRendererList(listParams); + + builder.UseRendererList(passData.rendererListHandle); + builder.UseTexture(resourceData.activeDepthTexture, AccessFlags.Read); + + builder.SetRenderFunc((PassData passData, UnsafeGraphContext context) => { + CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd); + + RenderTextureDescriptor maskDesc = passData.cameraData.cameraTargetDescriptor; + maskDesc.colorFormat = canUse16Bit ? RenderTextureFormat.RGB565 : RenderTextureFormat.ARGB32; + maskDesc.depthBufferBits = 0; + cmd.GetTemporaryRT(sharpenExclusionMaskId, maskDesc, FilterMode.Point); + cmd.SetGlobalTexture(sharpenExclusionMaskRT, sharpenExclusionMaskId); + RenderTargetIdentifier rti = new RenderTargetIdentifier(sharpenExclusionMaskId, 0, CubemapFace.Unknown, -1); + cmd.SetRenderTarget(rti, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, passData.depthTexture, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store); + cmd.ClearRenderTarget(false, true, Color.black); + + cmd.DrawRendererList(passData.rendererListHandle); + }); + } + } +#else + public override void FrameCleanup (CommandBuffer cmd) { + if (cmd == null) return; + cmd.ReleaseTemporaryRT(sharpenExclusionMaskId); + } +#endif + + } + + class BeautifyBloomLumMaskPass : ScriptableRenderPass { + + static readonly List m_ShaderTagIdList = new List(); + + const string bloomSourceDepthRT = "_BloomSourceDepth"; + static int bloomSourceDepthId = Shader.PropertyToID(bloomSourceDepthRT); + RTHandle maskRT; + + public BeautifyBloomLumMaskPass () { + RenderTargetIdentifier rti = new RenderTargetIdentifier(bloomSourceDepthRT, 0, CubemapFace.Unknown, -1); + maskRT = RTHandles.Alloc(rti, name: bloomSourceDepthRT); + renderPassEvent = RenderPassEvent.AfterRenderingOpaques; + m_ShaderTagIdList.Clear(); + m_ShaderTagIdList.Add(new ShaderTagId("SRPDefaultUnlit")); + m_ShaderTagIdList.Add(new ShaderTagId("UniversalForward")); + m_ShaderTagIdList.Add(new ShaderTagId("LightweightForward")); + } + +#if UNITY_2022_2_OR_NEWER + RTHandle depthRT; +#else + RenderTargetIdentifier depthRT; +#endif + + +#if UNITY_2022_1_OR_NEWER + public void SetupRenderTargets(ScriptableRenderer renderer) { +#if UNITY_2022_2_OR_NEWER +#pragma warning disable CS0618 + depthRT = renderer.cameraDepthTargetHandle; +#pragma warning restore CS0618 +#else + depthRT = renderer.cameraDepthTarget; +#endif + } +#else + public override void OnCameraSetup (CommandBuffer cmd, ref RenderingData renderingData) { + depthRT = renderingData.cameraData.renderer.cameraDepthTarget; + } +#endif + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Configure (CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { + RenderTextureDescriptor depthDesc = cameraTextureDescriptor; + depthDesc.colorFormat = RenderTextureFormat.ARGB32; + depthDesc.depthBufferBits = 0; + cmd.GetTemporaryRT(bloomSourceDepthId, depthDesc, FilterMode.Point); + cmd.SetGlobalTexture(bloomSourceDepthRT, bloomSourceDepthId); + if (BeautifySettings.anamorphicFlaresExcludeMask == BeautifySettings.bloomExcludeMask) { + cmd.SetGlobalTexture(BeautifyAnamorphicFlaresLumMaskPass.afSourceDepthRT, bloomSourceDepthId); + } + ConfigureTarget(maskRT, depthRT); + ConfigureClear(ClearFlag.Color, Color.black); + } + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Execute (ScriptableRenderContext context, ref RenderingData renderingData) { + + SortingCriteria sortingCriteria = SortingCriteria.None; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, ref renderingData, sortingCriteria); + var filter = new FilteringSettings(RenderQueueRange.all) { layerMask = BeautifySettings.bloomExcludeMask }; +#if UNITY_2023_1_OR_NEWER + CommandBuffer cmd = CommandBufferPool.Get("Beautify Luma Mask"); + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + RendererList list = context.CreateRendererList(ref listParams); + cmd.DrawRendererList(list); + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); +#else + context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref filter); +#endif + } + +#if UNITY_2023_3_OR_NEWER + class PassData { + public TextureHandle depthTexture; + public RendererListHandle rendererListHandle; + public UniversalCameraData cameraData; + } + + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { + + using (var builder = renderGraph.AddUnsafePass("Beautify Bloom Luminance Mask Pass", out var passData)) { + + builder.AllowPassCulling(false); + + UniversalResourceData resourceData = frameData.Get(); + UniversalRenderingData renderingData = frameData.Get(); + UniversalLightData lightData = frameData.Get(); + UniversalCameraData cameraData = frameData.Get(); + passData.depthTexture = resourceData.activeDepthTexture; + passData.cameraData = cameraData; + + SortingCriteria sortingCriteria = SortingCriteria.None; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, renderingData, cameraData, lightData, sortingCriteria); + var filter = new FilteringSettings(RenderQueueRange.all) { layerMask = BeautifySettings.bloomExcludeMask }; + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + passData.rendererListHandle = renderGraph.CreateRendererList(listParams); + + builder.UseRendererList(passData.rendererListHandle); + builder.UseTexture(resourceData.activeDepthTexture, AccessFlags.Read); + + builder.SetRenderFunc((PassData passData, UnsafeGraphContext context) => { + CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd); + + RenderTextureDescriptor depthDesc = passData.cameraData.cameraTargetDescriptor; + depthDesc.colorFormat = RenderTextureFormat.ARGB32; + depthDesc.depthBufferBits = 0; + cmd.GetTemporaryRT(bloomSourceDepthId, depthDesc, FilterMode.Point); + cmd.SetGlobalTexture(bloomSourceDepthRT, bloomSourceDepthId); + if (BeautifySettings.anamorphicFlaresExcludeMask == BeautifySettings.bloomExcludeMask) { + cmd.SetGlobalTexture(BeautifyAnamorphicFlaresLumMaskPass.afSourceDepthRT, bloomSourceDepthId); + } + RenderTargetIdentifier rti = new RenderTargetIdentifier(bloomSourceDepthId, 0, CubemapFace.Unknown, -1); + cmd.SetRenderTarget(rti, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, passData.depthTexture, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store); + cmd.ClearRenderTarget(false, true, Color.black); + + cmd.DrawRendererList(passData.rendererListHandle); + }); + } + } +#else + public override void FrameCleanup (CommandBuffer cmd) { + if (cmd == null) return; + cmd.ReleaseTemporaryRT(bloomSourceDepthId); + } +#endif + + } + + + class BeautifyAnamorphicFlaresLumMaskPass : ScriptableRenderPass { + + static readonly List m_ShaderTagIdList = new List(); + + public const string afSourceDepthRT = "_AFSourceDepth"; + static int afSourceDepthId = Shader.PropertyToID(afSourceDepthRT); + RTHandle maskRT; + + public BeautifyAnamorphicFlaresLumMaskPass () { + RenderTargetIdentifier rti = new RenderTargetIdentifier(afSourceDepthRT, 0, CubemapFace.Unknown, -1); + maskRT = RTHandles.Alloc(rti, name: afSourceDepthRT); + renderPassEvent = RenderPassEvent.BeforeRenderingTransparents; + m_ShaderTagIdList.Clear(); + m_ShaderTagIdList.Add(new ShaderTagId("SRPDefaultUnlit")); + m_ShaderTagIdList.Add(new ShaderTagId("UniversalForward")); + m_ShaderTagIdList.Add(new ShaderTagId("LightweightForward")); + } + +#if UNITY_2022_2_OR_NEWER + RTHandle depthRT; +#else + RenderTargetIdentifier depthRT; +#endif + + +#if UNITY_2022_1_OR_NEWER + public void SetupRenderTargets(ScriptableRenderer renderer) { +#if UNITY_2022_2_OR_NEWER +#pragma warning disable CS0618 + depthRT = renderer.cameraDepthTargetHandle; +#pragma warning restore CS0618 +#else + depthRT = renderer.cameraDepthTarget; +#endif + } +#else + public override void OnCameraSetup (CommandBuffer cmd, ref RenderingData renderingData) { + depthRT = renderingData.cameraData.renderer.cameraDepthTarget; + } +#endif + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Configure (CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { + RenderTextureDescriptor depthDesc = cameraTextureDescriptor; + depthDesc.colorFormat = RenderTextureFormat.ARGB32; + depthDesc.depthBufferBits = 0; + cmd.GetTemporaryRT(afSourceDepthId, depthDesc, FilterMode.Point); + cmd.SetGlobalTexture(afSourceDepthRT, afSourceDepthId); + ConfigureTarget(maskRT, depthRT); + ConfigureClear(ClearFlag.Color, Color.black); + } + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Execute (ScriptableRenderContext context, ref RenderingData renderingData) { + + SortingCriteria sortingCriteria = SortingCriteria.None; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, ref renderingData, sortingCriteria); + var filter = new FilteringSettings(RenderQueueRange.all) { layerMask = BeautifySettings.anamorphicFlaresExcludeMask }; +#if UNITY_2023_1_OR_NEWER + CommandBuffer cmd = CommandBufferPool.Get("AF Luma Mask"); + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + RendererList list = context.CreateRendererList(ref listParams); + cmd.DrawRendererList(list); + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); +#else + context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref filter); +#endif + } + +#if UNITY_2023_3_OR_NEWER + class PassData { + public TextureHandle depthTexture; + public RendererListHandle rendererListHandle; + public UniversalCameraData cameraData; + } + + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { + + using (var builder = renderGraph.AddUnsafePass("Beautify AF Luminance Mask Pass", out var passData)) { + builder.AllowPassCulling(false); + + UniversalResourceData resourceData = frameData.Get(); + UniversalRenderingData renderingData = frameData.Get(); + UniversalLightData lightData = frameData.Get(); + UniversalCameraData cameraData = frameData.Get(); + passData.depthTexture = resourceData.activeDepthTexture; + builder.UseTexture(resourceData.activeDepthTexture, AccessFlags.Read); + passData.cameraData = cameraData; + + SortingCriteria sortingCriteria = SortingCriteria.None; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, renderingData, cameraData, lightData, sortingCriteria); + var filter = new FilteringSettings(RenderQueueRange.all) { layerMask = BeautifySettings.anamorphicFlaresExcludeMask }; + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + passData.rendererListHandle = renderGraph.CreateRendererList(listParams); + + builder.UseRendererList(passData.rendererListHandle); + + builder.SetRenderFunc((PassData passData, UnsafeGraphContext context) => { + CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd); + + RenderTextureDescriptor depthDesc = passData.cameraData.cameraTargetDescriptor; + depthDesc.colorFormat = RenderTextureFormat.ARGB32; + depthDesc.depthBufferBits = 0; + cmd.GetTemporaryRT(afSourceDepthId, depthDesc, FilterMode.Point); + cmd.SetGlobalTexture(afSourceDepthRT, afSourceDepthId); + RenderTargetIdentifier rti = new RenderTargetIdentifier(afSourceDepthId, 0, CubemapFace.Unknown, -1); + cmd.SetRenderTarget(rti, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, passData.depthTexture, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store); + cmd.ClearRenderTarget(false, true, Color.black); + + cmd.DrawRendererList(passData.rendererListHandle); + }); + } + } +#else + public override void FrameCleanup (CommandBuffer cmd) { + if (cmd == null) return; + cmd.ReleaseTemporaryRT(afSourceDepthId); + } +#endif + + } + + class BeautifyDoFTransparentMaskPass : ScriptableRenderPass { + + static readonly List m_ShaderTagIdList = new List(); + static readonly List cutOutRenderers = new List(); + + const string dofTransparentDepthRT = "_DoFTransparentDepth"; + static int dofTransparentDepthId = Shader.PropertyToID(dofTransparentDepthRT); + static int m_CullPropertyId = Shader.PropertyToID("_Cull"); + const string m_ProfilerTag = "CustomDepthPrePass"; + const string m_DepthOnlyShader = "Hidden/Beautify2/DepthOnly"; + + RTHandle m_Depth; + + static Material depthOnlyMaterial, depthOnlyMaterialCutOff; + static int currentAlphaCutoutLayerMask = -999; + static Material[] depthOverrideMaterials; + + public BeautifyDoFTransparentMaskPass () { + RenderTargetIdentifier rti = new RenderTargetIdentifier(dofTransparentDepthRT, 0, CubemapFace.Unknown, -1); + m_Depth = RTHandles.Alloc(rti, name: dofTransparentDepthRT); + renderPassEvent = RenderPassEvent.AfterRenderingOpaques; + m_ShaderTagIdList.Clear(); + m_ShaderTagIdList.Add(new ShaderTagId("SRPDefaultUnlit")); + m_ShaderTagIdList.Add(new ShaderTagId("UniversalForward")); + m_ShaderTagIdList.Add(new ShaderTagId("LightweightForward")); + } + + + static void FindAlphaClippingRenderers () { + BeautifySettings._refreshAlphaClipRenderers = false; + cutOutRenderers.Clear(); + currentAlphaCutoutLayerMask = BeautifySettings.dofAlphaTestLayerMask; +#if UNITY_2023_1_OR_NEWER + Renderer[] rr = FindObjectsByType(FindObjectsSortMode.None); +#else + Renderer[] rr = FindObjectsOfType(); +#endif + int rrLength = rr.Length; + for (int r = 0; r < rrLength; r++) { + if (((1 << rr[r].gameObject.layer) & currentAlphaCutoutLayerMask) != 0) { + cutOutRenderers.Add(rr[r]); + } + } + } + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Configure (CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { + RenderTextureDescriptor depthDesc = cameraTextureDescriptor; + depthDesc.colorFormat = RenderTextureFormat.Depth; + depthDesc.depthBufferBits = 24; + depthDesc.msaaSamples = 1; + cmd.GetTemporaryRT(dofTransparentDepthId, depthDesc, FilterMode.Point); + cmd.SetGlobalTexture(dofTransparentDepthRT, dofTransparentDepthId); + ConfigureTarget(m_Depth); + ConfigureClear(ClearFlag.All, Color.black); + } + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Execute (ScriptableRenderContext context, ref RenderingData renderingData) { + + CommandBuffer cmd = CommandBufferPool.Get(m_ProfilerTag); + cmd.Clear(); + + if (BeautifySettings.dofAlphaTestSupport) { + if (BeautifySettings.dofAlphaTestLayerMask != 0) { + if (BeautifySettings.dofAlphaTestLayerMask != currentAlphaCutoutLayerMask || BeautifySettings._refreshAlphaClipRenderers) { + FindAlphaClippingRenderers(); + } + if (depthOnlyMaterialCutOff == null) { + Shader depthOnlyCutOff = Shader.Find(m_DepthOnlyShader); + depthOnlyMaterialCutOff = new Material(depthOnlyCutOff); + } + int renderersCount = cutOutRenderers.Count; + if (depthOverrideMaterials == null || depthOverrideMaterials.Length < renderersCount) { + depthOverrideMaterials = new Material[renderersCount]; + } + for (int k = 0; k < renderersCount; k++) { + Renderer renderer = cutOutRenderers[k]; + if (renderer != null && renderer.isVisible) { + Material mat = renderer.sharedMaterial; + if (mat != null) { + if (depthOverrideMaterials[k] == null) { + depthOverrideMaterials[k] = Instantiate(depthOnlyMaterialCutOff); + depthOverrideMaterials[k].EnableKeyword(ShaderParams.SKW_CUSTOM_DEPTH_ALPHA_TEST); + } + Material overrideMaterial = depthOverrideMaterials[k]; + + if (mat.HasProperty(ShaderParams.CustomDepthAlphaCutoff)) { + overrideMaterial.SetFloat(ShaderParams.CustomDepthAlphaCutoff, mat.GetFloat(ShaderParams.CustomDepthAlphaCutoff)); + } + else { + overrideMaterial.SetFloat(ShaderParams.CustomDepthAlphaCutoff, 0.5f); + } + if (mat.HasProperty(ShaderParams.CustomDepthBaseMap)) { + overrideMaterial.SetTexture(ShaderParams.CustomDepthBaseMap, mat.GetTexture(ShaderParams.CustomDepthBaseMap)); + } + else if (mat.HasProperty(ShaderParams.mainTex)) { + overrideMaterial.SetTexture(ShaderParams.CustomDepthBaseMap, mat.GetTexture(ShaderParams.mainTex)); + } + overrideMaterial.SetInt(m_CullPropertyId, BeautifySettings.dofAlphaTestDoubleSided ? (int)CullMode.Off : (int)CullMode.Back); + + cmd.DrawRenderer(renderer, overrideMaterial); + } + } + } + + } + } + + // Render transparent objects + if (BeautifySettings.dofTransparentSupport) { + if (depthOnlyMaterial == null) { + depthOnlyMaterial = new Material(Shader.Find(m_DepthOnlyShader)); + } + depthOnlyMaterial.SetInt(m_CullPropertyId, BeautifySettings.dofTransparentDoubleSided ? (int)CullMode.Off : (int)CullMode.Back); + + SortingCriteria sortingCriteria = renderingData.cameraData.defaultOpaqueSortFlags; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, ref renderingData, sortingCriteria); + drawingSettings.perObjectData = PerObjectData.None; + drawingSettings.overrideMaterial = depthOnlyMaterial; + var filter = new FilteringSettings(RenderQueueRange.transparent) { layerMask = BeautifySettings.dofTransparentLayerMask }; +#if UNITY_2023_1_OR_NEWER + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + RendererList list = context.CreateRendererList(ref listParams); + cmd.DrawRendererList(list); +#else + context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref filter); +#endif + } + + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); + } + + +#if UNITY_2023_3_OR_NEWER + class PassData { + public UniversalCameraData cameraData; + public RendererListHandle rendererListHandle; + } + + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { + + using (var builder = renderGraph.AddUnsafePass("Beautify DoF Transp Mask Pass RG", out var passData)) { + + builder.AllowPassCulling(false); + + UniversalResourceData resourceData = frameData.Get(); + UniversalRenderingData renderingData = frameData.Get(); + UniversalCameraData cameraData = frameData.Get(); + UniversalLightData lightData = frameData.Get(); + passData.cameraData = cameraData; + + if (BeautifySettings.dofTransparentSupport) { + SortingCriteria sortingCriteria = cameraData.defaultOpaqueSortFlags; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, renderingData, cameraData, lightData, sortingCriteria); + drawingSettings.perObjectData = PerObjectData.None; + if (depthOnlyMaterial == null) { + depthOnlyMaterial = new Material(Shader.Find(m_DepthOnlyShader)); + } + depthOnlyMaterial.SetInt(m_CullPropertyId, BeautifySettings.dofTransparentDoubleSided ? (int)CullMode.Off : (int)CullMode.Back); + drawingSettings.overrideMaterial = depthOnlyMaterial; + var filter = new FilteringSettings(RenderQueueRange.transparent) { layerMask = BeautifySettings.dofTransparentLayerMask }; + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + passData.rendererListHandle = renderGraph.CreateRendererList(listParams); + builder.UseRendererList(passData.rendererListHandle); + } + + builder.SetRenderFunc((PassData passData, UnsafeGraphContext context) => { + + CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd); + + RenderTextureDescriptor depthDesc = passData.cameraData.cameraTargetDescriptor; + depthDesc.colorFormat = RenderTextureFormat.Depth; + depthDesc.depthBufferBits = 24; + depthDesc.msaaSamples = 1; + cmd.GetTemporaryRT(dofTransparentDepthId, depthDesc, FilterMode.Point); + cmd.SetGlobalTexture(dofTransparentDepthRT, dofTransparentDepthId); + + RenderTargetIdentifier rti = new RenderTargetIdentifier(dofTransparentDepthId, 0, CubemapFace.Unknown, -1); + cmd.SetRenderTarget(rti, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store); + cmd.ClearRenderTarget(true, true, Color.black); + + if (BeautifySettings.dofAlphaTestSupport) { + if (BeautifySettings.dofAlphaTestLayerMask != 0) { + if (BeautifySettings.dofAlphaTestLayerMask != currentAlphaCutoutLayerMask) { + FindAlphaClippingRenderers(); + } + if (depthOnlyMaterialCutOff == null) { + Shader depthOnlyCutOff = Shader.Find(m_DepthOnlyShader); + depthOnlyMaterialCutOff = new Material(depthOnlyCutOff); + } + int renderersCount = cutOutRenderers.Count; + if (depthOverrideMaterials == null || depthOverrideMaterials.Length < renderersCount) { + depthOverrideMaterials = new Material[renderersCount]; + } + for (int k = 0; k < renderersCount; k++) { + Renderer renderer = cutOutRenderers[k]; + if (renderer != null && renderer.isVisible) { + Material mat = renderer.sharedMaterial; + if (mat != null) { + if (depthOverrideMaterials[k] == null) { + depthOverrideMaterials[k] = Instantiate(depthOnlyMaterialCutOff); + depthOverrideMaterials[k].EnableKeyword(ShaderParams.SKW_CUSTOM_DEPTH_ALPHA_TEST); + } + Material overrideMaterial = depthOverrideMaterials[k]; + + if (mat.HasProperty(ShaderParams.CustomDepthAlphaCutoff)) { + overrideMaterial.SetFloat(ShaderParams.CustomDepthAlphaCutoff, mat.GetFloat(ShaderParams.CustomDepthAlphaCutoff)); + } else { + overrideMaterial.SetFloat(ShaderParams.CustomDepthAlphaCutoff, 0.5f); + } + if (mat.HasProperty(ShaderParams.CustomDepthBaseMap)) { + overrideMaterial.SetTexture(ShaderParams.CustomDepthBaseMap, mat.GetTexture(ShaderParams.CustomDepthBaseMap)); + } else if (mat.HasProperty(ShaderParams.mainTex)) { + overrideMaterial.SetTexture(ShaderParams.CustomDepthBaseMap, mat.GetTexture(ShaderParams.mainTex)); + } + overrideMaterial.SetInt(m_CullPropertyId, BeautifySettings.dofAlphaTestDoubleSided ? (int)CullMode.Off : (int)CullMode.Back); + + cmd.DrawRenderer(renderer, overrideMaterial); + } + } + } + + } + } + + // Render transparent objects + if (BeautifySettings.dofTransparentSupport) { + cmd.DrawRendererList(passData.rendererListHandle); + } + }); + } + } +#else + public override void FrameCleanup (CommandBuffer cmd) { + if (cmd == null) return; + cmd.ReleaseTemporaryRT(dofTransparentDepthId); + } +#endif + } + + + class BeautifyOutlineDepthPrepass : ScriptableRenderPass { + + static readonly List m_ShaderTagIdList = new List(); + + const string outlineObjectIdRT = "_OutlineObjectId"; + const string outlineDepthRT = "_OutlineDepth"; + static int outlineDepthId = Shader.PropertyToID(outlineDepthRT); + static int m_CullPropertyId = Shader.PropertyToID("_Cull"); + const string m_ProfilerTag = "CustomOutlineDepthPrePass"; + const string m_DepthOnlyShader = "Hidden/Beautify2/DepthOnly"; + const string m_DepthOnlyWithObjectIdShader = "Hidden/Beautify2/DepthOnlyWithObjectId"; + const string m_DepthOnlyAlphaTestShader = "Hidden/Beautify2/DepthOnlyAlphaTest"; + const string m_DepthOnlyWithObjectIdAlphaTestShader = "Hidden/Beautify2/DepthOnlyWithObjectIdAlphaTest"; + + static Material depthOnlyMaterial, depthOnlyMaterialWithObjectId; + Shader depthOnlyShaderWithAlphaTest, depthOnlyShaderWithAlphaTestObjectId; + + public BeautifyOutlineDepthPrepass () { + renderPassEvent = RenderPassEvent.AfterRenderingOpaques; + m_ShaderTagIdList.Clear(); + m_ShaderTagIdList.Add(new ShaderTagId("SRPDefaultUnlit")); + m_ShaderTagIdList.Add(new ShaderTagId("UniversalForward")); + m_ShaderTagIdList.Add(new ShaderTagId("LightweightForward")); + } + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Configure (CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { + RenderTextureDescriptor depthDesc = cameraTextureDescriptor; + depthDesc.colorFormat = BeautifySettings.outlineUseObjectId ? RenderTextureFormat.RFloat : RenderTextureFormat.Depth; + depthDesc.depthBufferBits = 24; + depthDesc.msaaSamples = 1; + cmd.GetTemporaryRT(outlineDepthId, depthDesc, FilterMode.Point); + if (BeautifySettings.outlineUseObjectId) { + cmd.SetGlobalTexture(outlineObjectIdRT, outlineDepthId, RenderTextureSubElement.Color); + cmd.SetGlobalTexture(outlineDepthRT, outlineDepthId, RenderTextureSubElement.Depth); + } + else { + cmd.SetGlobalTexture(outlineDepthRT, outlineDepthId); + } +#if UNITY_2023_2_OR_NEWER && !UNITY_6000_0_OR_NEWER + RTHandle outlineDepthHandle = RTHandles.Alloc(outlineDepthId); + ConfigureTarget(outlineDepthHandle); +#else + RenderTargetIdentifier rti = new RenderTargetIdentifier(outlineDepthId, 0, CubemapFace.Unknown, -1); + ConfigureTarget(rti); +#endif + if (BeautifySettings.outlineUseObjectId) { + ConfigureClear(ClearFlag.Depth | ClearFlag.Color, Color.black); + } + else { + ConfigureClear(ClearFlag.Depth, Color.black); + } + } + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Execute (ScriptableRenderContext context, ref RenderingData renderingData) { + + if (!BeautifySettings.outlineDepthPrepass) return; + + SortingCriteria sortingCriteria = renderingData.cameraData.defaultOpaqueSortFlags; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, ref renderingData, sortingCriteria); + drawingSettings.perObjectData = PerObjectData.None; + + if (BeautifySettings.outlineDepthPrepassUseOptimizedShader) { +#if UNITY_2022_3_OR_NEWER + if (BeautifySettings.outlineLayerCutOff > 0) { + Shader alphaTestShader = null; + if (BeautifySettings.outlineUseObjectId) { + if (depthOnlyShaderWithAlphaTestObjectId == null) { + depthOnlyShaderWithAlphaTestObjectId = Shader.Find(m_DepthOnlyWithObjectIdAlphaTestShader); + } + alphaTestShader = depthOnlyShaderWithAlphaTestObjectId; + } else { + if (depthOnlyShaderWithAlphaTest == null) { + depthOnlyShaderWithAlphaTest = Shader.Find(m_DepthOnlyAlphaTestShader); + } + alphaTestShader = depthOnlyShaderWithAlphaTest; + } + drawingSettings.overrideShader = alphaTestShader; + Shader.SetGlobalFloat(ShaderParams.CustomDepthAlphaTestCutoff, BeautifySettings.outlineLayerCutOff); + } else +#endif + { + Material depthMaterial = null; + if (BeautifySettings.outlineUseObjectId) { + if (depthOnlyMaterialWithObjectId == null) { + depthOnlyMaterialWithObjectId = new Material(Shader.Find(m_DepthOnlyWithObjectIdShader)); + } + depthMaterial = depthOnlyMaterialWithObjectId; + } + else { + if (depthOnlyMaterial == null) { + depthOnlyMaterial = new Material(Shader.Find(m_DepthOnlyShader)); + } + depthMaterial = depthOnlyMaterial; + } + depthMaterial.SetInt(m_CullPropertyId, (int)CullMode.Back); + depthMaterial.DisableKeyword(ShaderParams.SKW_CUSTOM_DEPTH_ALPHA_TEST); + drawingSettings.overrideMaterial = depthMaterial; + } + } + + var filter = new FilteringSettings(RenderQueueRange.opaque) { layerMask = BeautifySettings.outlineLayerMask }; +#if UNITY_2023_1_OR_NEWER + CommandBuffer cmd = CommandBufferPool.Get(m_ProfilerTag); + cmd.Clear(); + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + RendererList list = context.CreateRendererList(ref listParams); + cmd.DrawRendererList(list); + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); +#else + context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref filter); +#endif + + } + + +#if UNITY_2023_3_OR_NEWER + class PassData { + public UniversalCameraData cameraData; + public RendererListHandle rendererListHandle; + } + + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { + + using (var builder = renderGraph.AddUnsafePass("Beautify Outline Depth Prepass RG", out var passData)) { + + builder.AllowPassCulling(false); + + UniversalResourceData resourceData = frameData.Get(); + UniversalRenderingData renderingData = frameData.Get(); + UniversalCameraData cameraData = frameData.Get(); + UniversalLightData lightData = frameData.Get(); + passData.cameraData = cameraData; + + SortingCriteria sortingCriteria = cameraData.defaultOpaqueSortFlags; + var drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, renderingData, cameraData, lightData, sortingCriteria); + drawingSettings.perObjectData = PerObjectData.None; + + if (BeautifySettings.outlineDepthPrepassUseOptimizedShader) { + if (BeautifySettings.outlineLayerCutOff > 0) { + Shader alphaTestShader = null; + if (BeautifySettings.outlineUseObjectId) { + if (depthOnlyShaderWithAlphaTestObjectId == null) { + depthOnlyShaderWithAlphaTestObjectId = Shader.Find(m_DepthOnlyWithObjectIdAlphaTestShader); + } + alphaTestShader = depthOnlyShaderWithAlphaTestObjectId; + } else { + if (depthOnlyShaderWithAlphaTest == null) { + depthOnlyShaderWithAlphaTest = Shader.Find(m_DepthOnlyAlphaTestShader); + } + alphaTestShader = depthOnlyShaderWithAlphaTest; + } + drawingSettings.overrideShader = alphaTestShader; + Shader.SetGlobalFloat(ShaderParams.CustomDepthAlphaTestCutoff, BeautifySettings.outlineLayerCutOff); + } else { + Material depthMaterial = null; + if (BeautifySettings.outlineUseObjectId) { + if (depthOnlyMaterialWithObjectId == null) { + depthOnlyMaterialWithObjectId = new Material(Shader.Find(m_DepthOnlyWithObjectIdShader)); + } + depthMaterial = depthOnlyMaterialWithObjectId; + } else { + if (depthOnlyMaterial == null) { + depthOnlyMaterial = new Material(Shader.Find(m_DepthOnlyShader)); + } + depthMaterial = depthOnlyMaterial; + } + depthMaterial.SetInt(m_CullPropertyId, (int)CullMode.Back); + depthMaterial.DisableKeyword(ShaderParams.SKW_CUSTOM_DEPTH_ALPHA_TEST); + drawingSettings.overrideMaterial = depthMaterial; + } + } + + var filter = new FilteringSettings(RenderQueueRange.opaque) { layerMask = BeautifySettings.outlineLayerMask }; + RendererListParams listParams = new RendererListParams(renderingData.cullResults, drawingSettings, filter); + passData.rendererListHandle = renderGraph.CreateRendererList(listParams); + builder.UseRendererList(passData.rendererListHandle); + + builder.SetRenderFunc((PassData passData, UnsafeGraphContext context) => { + + CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd); + + RenderTextureDescriptor depthDesc = passData.cameraData.cameraTargetDescriptor; + depthDesc.colorFormat = BeautifySettings.outlineUseObjectId ? RenderTextureFormat.RFloat : RenderTextureFormat.Depth; + depthDesc.depthBufferBits = 24; + depthDesc.msaaSamples = 1; + cmd.GetTemporaryRT(outlineDepthId, depthDesc, FilterMode.Point); + if (BeautifySettings.outlineUseObjectId) { + cmd.SetGlobalTexture(outlineObjectIdRT, outlineDepthId, RenderTextureSubElement.Color); + cmd.SetGlobalTexture(outlineDepthRT, outlineDepthId, RenderTextureSubElement.Depth); + } else { + cmd.SetGlobalTexture(outlineDepthRT, outlineDepthId); + } + + RenderTargetIdentifier rti = new RenderTargetIdentifier(outlineDepthId, 0, CubemapFace.Unknown, -1); + cmd.SetRenderTarget(rti, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store); + cmd.ClearRenderTarget(true, BeautifySettings.outlineUseObjectId, Color.black); + + // Render transparent objects + cmd.DrawRendererList(passData.rendererListHandle); + }); + } + } +#endif + } + + class BeautifyClearColorTarget : ScriptableRenderPass { + + const string m_ProfilerTag = "Beautify Clear Color Target"; + + public BeautifyClearColorTarget () { + renderPassEvent = RenderPassEvent.BeforeRenderingOpaques; + } + +#if UNITY_2023_3_OR_NEWER + [Obsolete] +#endif + public override void Execute (ScriptableRenderContext context, ref RenderingData renderingData) { + + CommandBuffer cmd = CommandBufferPool.Get(m_ProfilerTag); + cmd.ClearRenderTarget(false, true, new Color(0, 0, 0, 0)); + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); + } + +#if UNITY_2023_3_OR_NEWER + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { + using (var builder = renderGraph.AddUnsafePass(m_ProfilerTag, out var passData)) { + UniversalResourceData resourceData = frameData.Get(); + builder.UseTexture(resourceData.activeColorTexture, AccessFlags.ReadWrite); + + builder.SetRenderFunc((PassData passData, UnsafeGraphContext context) => { + CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd); + cmd.ClearRenderTarget(false, true, new Color(0, 0, 0, 0)); + }); + } + } +#endif + } + + [SerializeField, HideInInspector] + Shader shader; + BeautifyRenderPass m_BeautifyRenderPass; + BeautifyDoFTransparentMaskPass m_BeautifyDoFTransparentMaskPass; + BeautifyBloomLumMaskPass m_BeautifyBloomLumMaskPass; + BeautifyAnamorphicFlaresLumMaskPass m_BeautifyAnamorphicFlaresLumMaskPass; + BeautifySharpenExclusionMaskPass m_BeautifySharpenExclusionMaskPass; + BeautifyClearColorTarget m_BeautifyClearColorTarget; + BeautifyOutlineDepthPrepass m_BeautifyOutlineDepthPrepass; + + [Tooltip("Note: this option is ignored if Direct Write To Camera option in Beautify volume inspector is enabled.")] + public RenderPassEvent renderPassEvent = RenderPassEvent.AfterRenderingTransparents; + + [Tooltip("Allows Beautify to be executed even if camera has Post Processing option disabled.")] + public bool ignorePostProcessingOption; + +#if ENABLE_VR && ENABLE_XR_MODULE + [Tooltip("Ensures color buffer is cleared before rendering in XR. This option solves an issue with OpenXR and occlusion mesh which causes color bleeding when bloom is enabled.")] + public bool clearXRColorBuffer; +#endif + + [Tooltip("Specify which cameras can render Beautify effects")] + public LayerMask cameraLayerMask = -1; + + [Tooltip("Do not compile ACES tonemapping shader feature, reducing build time.")] + public bool stripBeautifyTonemappingACES; + + [Tooltip("Do not compile ACES Fitted tonemapping shader feature, reducing build time.")] + public bool stripBeautifyTonemappingACESFitted; + + [Tooltip("Do not compile AGX tonemapping shader feature, reducing build time.")] + public bool stripBeautifyTonemappingAGX; + + [Tooltip("Do not compile sharpen shader feature, reducing build time.")] + public bool stripBeautifySharpen; + + [Tooltip("Do not compile sharpen exclusion mask shader feature, reducing build time.")] + public bool stripBeautifySharpenExclusionMask = true; + + [Tooltip("Do not compile dithering shader feature, reducing build time.")] + public bool stripBeautifyDithering; + + [Tooltip("Do not compile edge antialiasing shader feature, reducing build time.")] + public bool stripBeautifyEdgeAA; + + [Tooltip("Do not compile LUT shader feature, reducing build time.")] + public bool stripBeautifyLUT; + + [Tooltip("Do not compile LUT 3D shader feature, reducing build time.")] + public bool stripBeautifyLUT3D = true; + + [Tooltip("Do not compile daltonize, sepia or white balance shader feature, reducing build time.")] + public bool stripBeautifyColorTweaks; + + [Tooltip("Do not compile Bloom, Anamorphic & Sun Flares shader features, reducing build time.")] + public bool stripBeautifyBloom; + + [Tooltip("Do not compile Lens Dirt shader feature, reducing build time.")] + public bool stripBeautifyLensDirt; + + [Tooltip("Do not compile Chromatic Aberration shader feature, reducing build time.")] + public bool stripBeautifyChromaticAberration; + + [Tooltip("Do not compile Depth Of Field shader feature, reducing build time.")] + public bool stripBeautifyDoF; + + [Tooltip("Do not compile Depth Of Field transparency support shader feature, reducing build time.")] + public bool stripBeautifyDoFTransparentSupport = true; + + [Tooltip("Do not compile Purkinje Shift shader feature, reducing build time.")] + public bool stripBeautifyEyeAdaptation = true; + + [Tooltip("Do not compile Purkinje Shift shader feature, reducing build time.")] + public bool stripBeautifyPurkinje = true; + + [Tooltip("Do not compile Vignetting shader features, reducing build time.")] + public bool stripBeautifyVignetting; + + [Tooltip("Do not compile Vignetting Mask shader feature, reducing build time.")] + public bool stripBeautifyVignettingMask = true; + + [Tooltip("Do not compile Outline shader feature, reducing build time.")] + public bool stripBeautifyOutline = true; + + [Tooltip("Do not compile Night Vision shader feature, reducing build time.")] + public bool stripBeautifyNightVision = true; + + [Tooltip("Do not compile Thermal Vision shader feature, reducing build time.")] + public bool stripBeautifyThermalVision = true; + + [Tooltip("Do not compile Frame shader features, reducing build time.")] + public bool stripBeautifyFrame = true; + + [Tooltip("Do not compile Film Grain shader feature, reducing build time.")] + public bool stripBeautifyFilmGrain = true; + + [Tooltip("Do not compile Unity Post Processing's Film Grain shader feature, reducing build time.")] + public bool stripUnityFilmGrain; + + [Tooltip("Do not compile Unity Post Processing's Dithering shader feature, reducing build time.")] + public bool stripUnityDithering; + + [Tooltip("Do not compile Unity Post Processing's Tonemapping shader feature, reducing build time.")] + public bool stripUnityTonemapping; + + [Tooltip("Do not compile Unity Post Processing's Bloom shader feature, reducing build time.")] + public bool stripUnityBloom; + + [Tooltip("Do not compile Unity Post Processing's Chromatic Aberration shader feature, reducing build time.")] + public bool stripUnityChromaticAberration; + + [Tooltip("Do not compile Unity Post Processing's Screen Distortion features, reducing build time.")] + public bool stripUnityDistortion; + + [Tooltip("Do not compile Unity Post Processing's debug variants, reducing build time.")] + public bool stripUnityDebugVariants; + + public static bool installed; + public static bool ignoringPostProcessingOption; + + + + +#if UNITY_2023_3_OR_NEWER + public static bool usingRenderGraph; + static TextureHandle directWriteTextureHandle; +#endif + +#if UNITY_EDITOR + public static CameraType captureCameraType = CameraType.SceneView; + public static bool requestScreenCapture; +#endif + + + void OnDisable () { + if (m_BeautifyRenderPass != null) { + m_BeautifyRenderPass.Cleanup(); + } + installed = false; + } + + + public override void Create () { + name = "Beautify"; + m_BeautifyRenderPass = new BeautifyRenderPass(); + m_BeautifyBloomLumMaskPass = new BeautifyBloomLumMaskPass(); + m_BeautifyAnamorphicFlaresLumMaskPass = new BeautifyAnamorphicFlaresLumMaskPass(); + m_BeautifySharpenExclusionMaskPass = new BeautifySharpenExclusionMaskPass(); + m_BeautifyDoFTransparentMaskPass = new BeautifyDoFTransparentMaskPass(); + m_BeautifyOutlineDepthPrepass = new BeautifyOutlineDepthPrepass(); + +#if ENABLE_VR && ENABLE_XR_MODULE + m_BeautifyClearColorTarget = new BeautifyClearColorTarget(); +#endif + shader = Shader.Find("Hidden/Kronnect/Beautify"); + +#if UNITY_EDITOR + SetStripShaderKeywords(); +#endif + } + +#if UNITY_2022_1_OR_NEWER + public override void SetupRenderPasses(ScriptableRenderer renderer, + in RenderingData renderingData) { + + CameraData cameraData = renderingData.cameraData; + Camera cam = cameraData.camera; + if ((cameraLayerMask & (1 << cam.gameObject.layer)) == 0) return; + + if (cam.targetTexture != null && cam.targetTexture.format == RenderTextureFormat.Depth) return; // ignore depth pre-pass cams! + + m_BeautifyRenderPass.SetupRenderTargets(renderer); + m_BeautifyBloomLumMaskPass.SetupRenderTargets(renderer); + m_BeautifyAnamorphicFlaresLumMaskPass.SetupRenderTargets(renderer); + m_BeautifySharpenExclusionMaskPass.SetupRenderTargets(renderer); + } +#endif + + public override void AddRenderPasses (ScriptableRenderer renderer, ref RenderingData renderingData) { + installed = true; + ignoringPostProcessingOption = ignorePostProcessingOption; + +#if UNITY_EDITOR + // Check if shader compilation or preparation is happening in background + if (UnityEditor.ShaderUtil.anythingCompiling) { + return; + } +#endif + +#if UNITY_2023_3_OR_NEWER + var renderGraphSettings = GraphicsSettings.GetRenderPipelineSettings(); + usingRenderGraph = !renderGraphSettings.enableRenderCompatibilityMode; +#endif + + if (ignorePostProcessingOption || renderingData.cameraData.postProcessEnabled) { + CameraData cameraData = renderingData.cameraData; + Camera cam = cameraData.camera; + if ((cameraLayerMask & (1 << cam.gameObject.layer)) == 0) return; + + if (cam.targetTexture != null && cam.targetTexture.format == RenderTextureFormat.Depth) return; // ignore depth pre-pass cams! + + if (m_BeautifyRenderPass.Setup(shader, renderer, renderingData, renderPassEvent, ignorePostProcessingOption)) { + + m_BeautifyRenderPass.UpdateMaterialProperties(cam); + if (BeautifySettings.bloomExcludeMask != 0) { + renderer.EnqueuePass(m_BeautifyBloomLumMaskPass); + } + if (BeautifySettings.anamorphicFlaresExcludeMask != 0 && BeautifySettings.anamorphicFlaresExcludeMask != BeautifySettings.bloomExcludeMask) { + renderer.EnqueuePass(m_BeautifyAnamorphicFlaresLumMaskPass); + } + if (BeautifySettings.sharpenExclusionMask != 0) { + renderer.EnqueuePass(m_BeautifySharpenExclusionMaskPass); + } + if (BeautifySettings.dofTransparentSupport || BeautifySettings.dofAlphaTestSupport) { + if (cam.cameraType == CameraType.Game) { + renderer.EnqueuePass(m_BeautifyDoFTransparentMaskPass); + } + } + if (BeautifySettings.outlineDepthPrepass) { + renderer.EnqueuePass(m_BeautifyOutlineDepthPrepass); + } + renderer.EnqueuePass(m_BeautifyRenderPass); + +#if ENABLE_VR && ENABLE_XR_MODULE + if (clearXRColorBuffer && renderingData.cameraData.xrRendering) { + renderer.EnqueuePass(m_BeautifyClearColorTarget); + } +#endif + } + } + } + + +#if UNITY_EDITOR + + public const string PLAYER_PREF_KEYNAME = "BeautifyStripKeywordSet"; + + + public void SetStripShaderKeywords () { + + if (Application.isPlaying) return; + + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + if (stripBeautifyEdgeAA) { + sb.Append(ShaderParams.SKW_EDGE_ANTIALIASING); + } + if (stripBeautifyBloom) { + sb.Append(ShaderParams.SKW_BLOOM); + sb.Append(ShaderParams.SKW_BLOOM_USE_DEPTH); + sb.Append(ShaderParams.SKW_BLOOM_USE_LAYER); + sb.Append(ShaderParams.SKW_BLOOM_USE_LAYER_INCLUSION); + sb.Append(ShaderParams.SKW_BLOOM_PROP_THRESHOLDING); + sb.Append(ShaderParams.SKW_ANAMORPHIC_FLARES_USE_DEPTH); + sb.Append(ShaderParams.SKW_ANAMORPHIC_FLARES_USE_LAYER); + sb.Append(ShaderParams.SKW_ANAMORPHIC_FLARES_USE_LAYER_INCLUSION); + sb.Append(ShaderParams.SKW_ANAMORPHIC_PROP_THRESHOLDING); + sb.Append(ShaderParams.SKW_SUN_FLARES_USE_GHOSTS); + sb.Append(ShaderParams.SKW_SUN_FLARES_OCCLUSION_INIT); + sb.Append(ShaderParams.SKW_SUN_FLARES_OCCLUSION_SIMPLE); + sb.Append(ShaderParams.SKW_SUN_FLARES_OCCLUSION_SMOOTH); + } + if (stripBeautifyDoF) { + sb.Append(ShaderParams.SKW_DEPTH_OF_FIELD); + sb.Append(ShaderParams.SKW_DEPTH_OF_FIELD_TRANSPARENT); + } + else if (stripBeautifyDoFTransparentSupport) { + sb.Append(ShaderParams.SKW_DEPTH_OF_FIELD_TRANSPARENT); + } + + if (stripBeautifyLensDirt) { + sb.Append(ShaderParams.SKW_DIRT); + } + if (stripBeautifyLUT3D) { + sb.Append(ShaderParams.SKW_LUT3D); + } + if (stripBeautifyLUT) { + sb.Append(ShaderParams.SKW_LUT); + } + if (stripBeautifyOutline) { + sb.Append(ShaderParams.SKW_OUTLINE); + sb.Append(ShaderParams.SKW_OUTLINE_CUSTOM_DEPTH); + sb.Append(ShaderParams.SKW_OUTLINE_OBJECT_ID); + sb.Append(ShaderParams.SKW_OUTLINE_MIN_SEPARATION); + sb.Append(ShaderParams.SKW_OUTLINE_OUTER_ONLY); + sb.Append(ShaderParams.SKW_OUTLINE_DEPTH_FADE); + } + if (stripBeautifyNightVision) { + sb.Append(ShaderParams.SKW_NIGHT_VISION); + } + if (stripBeautifyThermalVision) { + sb.Append(ShaderParams.SKW_THERMAL_VISION); + } + if (stripBeautifyColorTweaks) { + sb.Append(ShaderParams.SKW_COLOR_TWEAKS); + } + if (stripBeautifyPurkinje) { + sb.Append(ShaderParams.SKW_PURKINJE); + } + if (stripBeautifyTonemappingACES) { + sb.Append(ShaderParams.SKW_TONEMAP_ACES); + } + if (stripBeautifyTonemappingACESFitted) { + sb.Append(ShaderParams.SKW_TONEMAP_ACES_FITTED); + } + if (stripBeautifyTonemappingAGX) { + sb.Append(ShaderParams.SKW_TONEMAP_AGX); + } + if (stripBeautifyDithering) { + sb.Append(ShaderParams.SKW_DITHER); + } + if (stripBeautifySharpen) { + sb.Append(ShaderParams.SKW_SHARPEN); + sb.Append(ShaderParams.SKW_SHARPEN_EXCLUSION_MASK); + } + else if (stripBeautifySharpenExclusionMask) { + sb.Append(ShaderParams.SKW_SHARPEN_EXCLUSION_MASK); + } + if (stripBeautifyEyeAdaptation) { + sb.Append(ShaderParams.SKW_EYE_ADAPTATION); + sb.Append(ShaderParams.SKW_EA_USE_DEPTH); + sb.Append(ShaderParams.SKW_EA_USE_MASK); + } + if (stripBeautifyChromaticAberration) { + sb.Append(ShaderParams.SKW_CHROMATIC_ABERRATION); + } + if (stripBeautifyVignetting) { + sb.Append(ShaderParams.SKW_VIGNETTING); + sb.Append(ShaderParams.SKW_VIGNETTING_MASK); + } + else if (stripBeautifyVignettingMask) { + sb.Append(ShaderParams.SKW_VIGNETTING_MASK); + } + if (stripBeautifyFrame) { + sb.Append(ShaderParams.SKW_FRAME); + } + if (stripBeautifyFilmGrain) { + sb.Append(ShaderParams.SKW_FILM_GRAIN); + } + + if (stripUnityBloom) { + sb.Append("_BLOOM_LQ _BLOOM_HQ _BLOOM_LQ_DIRT _BLOOM_HQ_DIRT"); + } + if (stripUnityChromaticAberration) { + sb.Append("_CHROMATIC_ABERRATION"); + } + if (stripUnityDistortion) { + sb.Append("_DISTORTION"); + } + if (stripUnityFilmGrain) { + sb.Append("_FILM_GRAIN"); + } + if (stripUnityDithering) { + sb.Append("_DITHERING"); + } + if (stripUnityTonemapping) { + sb.Append("_TONEMAP_ACES _TONEMAP_NEUTRAL"); + } + if (stripUnityDebugVariants) { + sb.Append("DEBUG_DISPLAY"); + } + PlayerPrefs.SetString(PLAYER_PREF_KEYNAME, sb.ToString()); + } + + public static void StripBeautifyFeatures () { + var asset = UniversalRenderPipeline.asset; + if (asset == null) return; + + if (asset.scriptableRenderer is not UniversalRenderer renderer) return; + + var rendererFeaturesField = typeof(ScriptableRenderer) + .GetField("m_RendererFeatures", BindingFlags.NonPublic | BindingFlags.Instance); + + if (rendererFeaturesField == null) return; + + if (rendererFeaturesField.GetValue(renderer) is not List rendererFeatures) return; + + foreach (var feature in rendererFeatures) { + if (feature is BeautifyRendererFeature beautifyFeature) { + beautifyFeature.SetStripShaderKeywords(); + return; + } + } + + } + +#endif + + } +} diff --git a/Assets/External/Beautify/URP/Runtime/BeautifyRendererFeature.cs.meta b/Assets/External/Beautify/URP/Runtime/BeautifyRendererFeature.cs.meta new file mode 100644 index 00000000..66de2415 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/BeautifyRendererFeature.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 7cbabd8e2cb2e4f8a930752453adf79a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: + - settings: {fileID: 11400000, guid: 68dde9df85a05a54fbc92e3b6f3a8c42, type: 2} + - hbaoShader: {fileID: 4800000, guid: bf610497676b34e4dbe0f14fe3fe311c, type: 3} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/BeautifySettings.cs b/Assets/External/Beautify/URP/Runtime/BeautifySettings.cs new file mode 100644 index 00000000..28c8cefc --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/BeautifySettings.cs @@ -0,0 +1,226 @@ +using System; +using System.Collections; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; +using UnityEngine.SceneManagement; + +namespace Beautify.Universal { + + public delegate float OnBeforeFocusEvent(float currentFocusDistance); + + + [ExecuteAlways] + public class BeautifySettings : MonoBehaviour { + + [Header("Scene Settings")] + public Transform sun; + public Transform depthOfFieldTarget; + + public OnBeforeFocusEvent OnBeforeFocus; + + public static float depthOfFieldCurrentFocalPointDistance; + + public static int bloomExcludeMask; + + public static int anamorphicFlaresExcludeMask; + + public static int sharpenExclusionMask; + + public static bool dofTransparentSupport; + + public static int dofTransparentLayerMask; + + public static bool dofTransparentDoubleSided; + + public static bool dofAlphaTestSupport; + + public static int dofAlphaTestLayerMask; + + public static bool dofAlphaTestDoubleSided; + + public static bool outlineDepthPrepass; + public static bool outlineUseObjectId; + public static int outlineLayerMask; + public static float outlineLayerCutOff; + + public static bool outlineDepthPrepassUseOptimizedShader; + + internal static bool _refreshAlphaClipRenderers; + + static BeautifySettings _instance; + static Volume _beautifyVolume; + static Beautify _beautify; + + /// + /// Forces a reset of the internal cached settings of Beautify. Call this method if Beautify settings are not resetted when switching scenes. + /// + public static void UnloadBeautify() { + _instance = null; + _beautifyVolume = null; + _beautify = null; + } + + /// + /// Returns a reference to the Beautify Settings component attached to the Post Processing Layer or camera + /// + /// The instance. + public static BeautifySettings instance { + get { + if (_instance == null) { +#if UNITY_2023_1_OR_NEWER + _instance = FindAnyObjectByType(); +#else + _instance = FindObjectOfType(); +#endif + if (_instance == null) { + // Check if there's a single volume component, then add BeautifySettings singleton to that gameobject + _beautifyVolume = FindBeautifyVolume(); + if (_beautifyVolume == null) { + return null; + } + GameObject go = _beautifyVolume.gameObject; + _instance = go.GetComponent(); + if (_instance == null) { + _instance = go.AddComponent(); + } + } + } + return _instance; + } + } + + + static Volume FindBeautifyVolume() { +#if UNITY_2023_1_OR_NEWER + Volume[] vols = FindObjectsByType(FindObjectsSortMode.None); +#else + Volume[] vols = FindObjectsOfType(); +#endif + foreach (Volume volume in vols) { + if (volume.sharedProfile != null && volume.sharedProfile.Has()) { + _beautifyVolume = volume; + return volume; + } + } + return null; + } + + /// + /// Returns a reference to the settings of Beautify in the Post Processing Profile + /// + /// The shared settings. + public static Beautify sharedSettings { + get { + if (_beautify != null) return _beautify; + if (_beautifyVolume == null) FindBeautifyVolume(); + if (_beautifyVolume == null) return null; + + bool foundEffectSettings = _beautifyVolume.sharedProfile.TryGet(out _beautify); + if (!foundEffectSettings) { + Debug.Log("Cant load Beautify settings"); + return null; + } + return _beautify; + } + } + + /// + /// Returns the profile of the volume in the scene where Beautify has been found + /// + public static VolumeProfile currentProfile { + get { + if (_beautifyVolume == null) { + FindBeautifyVolume(); + } + if (_beautifyVolume == null) return null; + return _beautifyVolume.sharedProfile; + } + } + + /// + /// Returns a copy of the settings of Beautify in the Post Processing Profile + /// + /// The settings. + public static Beautify settings { + get { + if (_beautify != null) return _beautify; + if (_beautifyVolume == null) FindBeautifyVolume(); + if (_beautifyVolume == null) return null; + + bool foundEffectSettings = _beautifyVolume.profile.TryGet(out _beautify); + if (!foundEffectSettings) { + Debug.Log("Cant load Beautify settings"); + return null; + } + return _beautify; + } + } + + + public static void Blink(float duration, float maxValue = 1) { + if (duration <= 0) + return; + BeautifySettings i = instance; + if (i == null) return; + i.StartCoroutine(i.DoBlink(duration, maxValue)); + } + + IEnumerator DoBlink(float duration, float maxValue) { + + Beautify beautify = settings; + if (beautify == null) yield break; + float start = Time.time; + WaitForEndOfFrame w = new WaitForEndOfFrame(); + beautify.vignettingBlink.overrideState = true; + float t; + // Close + do { + t = (Time.time - start) / duration; + if (t > 1f) + t = 1f; + float easeOut = t * (2f - t); + beautify.vignettingBlink.value = easeOut * maxValue; + yield return w; + } while (t < 1f); + + // Open + start = Time.time; + do { + t = (Time.time - start) / duration; + if (t > 1f) + t = 1f; + float easeIn = t * t; + beautify.vignettingBlink.value = (1f - easeIn) * maxValue; + yield return w; + } while (t < 1f); + beautify.vignettingBlink.overrideState = false; + } + + void OnEnable() { + #if UNITY_EDITOR + if (!Application.isPlaying) { + BeautifyRendererFeature.StripBeautifyFeatures(); + } + #endif + SceneManager.sceneLoaded += SceneManager_sceneLoaded; + } + + private void OnDisable() { + SceneManager.sceneLoaded -= SceneManager_sceneLoaded; + } + + private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { + UnloadBeautify(); + } + + + /// + /// Updates the list of alpha clip renderers + /// + public static void UpdateAlphaClipRenderers() { + _refreshAlphaClipRenderers = true; + } + + } +} diff --git a/Assets/External/Beautify/URP/Runtime/BeautifySettings.cs.meta b/Assets/External/Beautify/URP/Runtime/BeautifySettings.cs.meta new file mode 100644 index 00000000..6703b56a --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/BeautifySettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b900b6d691ae49f8a12753b63b449e7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources.meta b/Assets/External/Beautify/URP/Runtime/Resources.meta new file mode 100644 index 00000000..d0f5fffd --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd2fa24da90af4844be20dbbe575d1a3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders.meta new file mode 100644 index 00000000..95f0b7dc --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 237b12990f9ca472dad17b772b02c39c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyACESFitted.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyACESFitted.hlsl new file mode 100644 index 00000000..9d1d80d9 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyACESFitted.hlsl @@ -0,0 +1,55 @@ +// This file "BeautifyACESFitted.hlsl" is covered by MIT license as follows: +// +//================================================================================================= +// +// ACES Fitted, an alternate ACES tonemap operator by MJP and David Neubelt +// http://mynameismjp.wordpress.com/ +// +// Licensed under the MIT license +// +//================================================================================================= +// The code in this file was originally written by Stephen Hill (@self_shadow), who deserves all +// credit for coming up with this fit and implementing it. Buy him a beer next time you see him. :) + +#ifndef BEAUTIFY_ACES_FITTED +#define BEAUTIFY_ACES_FITTED + +// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT +static const float3x3 ACESInputMat = +{ + {0.59719, 0.35458, 0.04823}, + {0.07600, 0.90834, 0.01566}, + {0.02840, 0.13383, 0.83777} +}; + +// ODT_SAT => XYZ => D60_2_D65 => sRGB +static const float3x3 ACESOutputMat = +{ + { 1.60475, -0.53108, -0.07367}, + {-0.10208, 1.10813, -0.00605}, + {-0.00327, -0.07276, 1.07602} +}; + +float3 RRTAndODTFit(float3 v) +{ + float3 a = v * (v + 0.0245786f) - 0.000090537f; + float3 b = v * (0.983729f * v + 0.4329510f) + 0.238081f; + return a / b; +} + +float3 ACESFitted(float3 val) +{ + val = mul(ACESInputMat, val); + + // Apply RRT and ODT + val = RRTAndODTFit(val); + + val = mul(ACESOutputMat, val); + + // Clamp to [0, 1] + //val = saturate(val); + + return val; +} + +#endif // BEAUTIFY_ACES_FITTED \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyACESFitted.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyACESFitted.hlsl.meta new file mode 100644 index 00000000..1a169102 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyACESFitted.hlsl.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 2a60bf244efbd4a2cb2d66d73177f740 +timeCreated: 1517506872 +licenseType: Pro +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyAGX.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyAGX.hlsl new file mode 100644 index 00000000..5614bf29 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyAGX.hlsl @@ -0,0 +1,96 @@ +// This file (BeautifyAGX.hlsl) is covered by MIT license as follows: +// +// MIT License +// +// Copyright (c) 2024 Missing Deadlines (Benjamin Wrensch) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright and this permission shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +// All values used to derive this implementation are sourced from Troy’s initial AgX implementation/OCIO config file available here: +// https://github.com/sobotka/AgX +// Adaptation to HLSL for Unity by Kronnect + +#ifndef BEAUTIFY_AGX +#define BEAUTIFY_AGX + +float _TonemapAGXGamma; + +static const float3x3 agx_mat = float3x3( + 0.842479062253094, 0.0784335999999992, 0.0792237451477643, + 0.0423282422610123, 0.878468636469772, 0.0791661274605434, + 0.0423756549057051, 0.0784336, 0.879142973793104); + +static const float3x3 agx_mat_inv = float3x3( + 1.19687900512017, -0.0980208811401368, -0.0990297440797205, + -0.0528968517574562, 1.15190312990417, -0.0989611768448433, + -0.0529716355144438, -0.0980434501171241, 1.15107367264116); + +// Mean error^2: 3.6705141e-06 +float3 agxDefaultContrastApprox(float3 x) { + float3 x2 = x * x; + float3 x4 = x2 * x2; + + return 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} + + +float3 agx(float3 val) { + + const float min_ev = -12.47393f; + const float max_ev = 4.026069f; + + // Input transform (inset) + val = mul(agx_mat, val); + + // Log2 space encoding + val = clamp(log2(val), min_ev, max_ev); + val = (val - min_ev) / (max_ev - min_ev); + + // Apply sigmoid function approximation + val = agxDefaultContrastApprox(val); + + return val; +} + +float3 agxEotf(float3 val) { + + // Inverse input transform (outset) + val = mul(agx_mat_inv, val); + + // sRGB IEC 61966-2-1 2.2 Exponent Reference EOTF Display + // NOTE: We're linearizing the output here. Comment/adjust when + // *not* using a sRGB render target + val = pow(val, _TonemapAGXGamma); + + return val; +} + +float3 AGXFitted(float3 value) { + value = agx(value); + value = agxEotf(value); + return value; +} + +#endif \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyAGX.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyAGX.hlsl.meta new file mode 100644 index 00000000..60a47288 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyAGX.hlsl.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: f1496f614c1d5445583417c070512078 +timeCreated: 1517506872 +licenseType: Pro +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCAberration.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCAberration.hlsl new file mode 100644 index 00000000..99ca3a45 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCAberration.hlsl @@ -0,0 +1,21 @@ +#ifndef BEAUTIFY_CABERRATION_INCLUDE +#define BEAUTIFY_CABERRATION_INCLUDE + + // Copyright 2020-2021 Kronnect - All Rights Reserved. + #include "BeautifyCommon.hlsl" + + TEXTURE2D_X(_MainTex); + SAMPLER(sampler_MainTex); + float4 _MainTex_TexelSize; + + #include "BeautifyDistortion.hlsl" + + float4 fragChromaticAberration (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + float4 pixel = GetDistortedColor(i.uv); + return pixel; + } + + +#endif // BEAUTIFY_CABERRATION_INCLUDE \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCAberration.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCAberration.hlsl.meta new file mode 100644 index 00000000..8b91c430 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCAberration.hlsl.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1fff09f3f51e64815b1cf93c283fb99a +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyColorTemp.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyColorTemp.hlsl new file mode 100644 index 00000000..142b4900 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyColorTemp.hlsl @@ -0,0 +1,28 @@ +#ifndef BEAUTIFY_COLOR_TEMP +#define BEAUTIFY_COLOR_TEMP + +const float LuminancePreservationFactor = 1.0; + +const float PI2 = 6.2831853071; + +// kelvin = { 1000 - 40000 } +float3 KelvinToRGB(float kelvin) { + const float3x3 cold = float3x3(float3(0.0, -2902.1955373783176, -8257.7997278925690), + float3(0.0, 1669.5803561666639, 2575.2827530017594), + float3(1.0, 1.3302673723350029, 1.8993753891711275)); + const float3x3 hot = float3x3(float3(0.0, -2902.1955373783176, -8257.7997278925690), + float3(0.0, 1669.5803561666639, 2575.2827530017594), + float3(1.0, 1.3302673723350029, 1.8993753891711275)); + + float3x3 m = (kelvin <= 6500.0) ? cold : hot; + + float3 m0 = float3(m[0][0], m[0][1], m[0][2]); + float3 m1 = float3(m[1][0], m[1][1], m[1][2]); + float3 m2 = float3(m[2][0], m[2][1], m[2][2]); + float3 cm = lerp(( m0 / (clamp(kelvin, 1000.0, 40000.0).xxx + m1) + m2), + 1.0.xxx, + smoothstep(1000.0, 0.0, kelvin)); + return cm; +} + +#endif // BEAUTIFY_COLOR_TEMP \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyColorTemp.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyColorTemp.hlsl.meta new file mode 100644 index 00000000..1ceb1850 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyColorTemp.hlsl.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 01837ee01fce64c8db5624c139e32ac5 +timeCreated: 1517506872 +licenseType: Pro +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCommon.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCommon.hlsl new file mode 100644 index 00000000..2a2ec09b --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCommon.hlsl @@ -0,0 +1,159 @@ +#ifndef __BEAUTIFY_COMMON_INCLUDE +#define __BEAUTIFY_COMMON_INCLUDE + +// Set to 1 to support orthographic mode +#define BEAUTIFY_ORTHO 0 + +// Set to 1 to enable Sobel outline +#define BEAUTIFY_OUTLINE_SOBEL 0 + +// Set to 1 to enable alternate chromatic aberration method +#define BEAUTIFY_CABERRATION_ALT 0 + +// Set to 1 to use legacy eye adaptation mode +#define BEAUTIFY_EA_LEGACY_MODE 0 + +TEXTURE2D(_BlueNoise); +float4 _BlueNoise_TexelSize; + +TEXTURE2D_X_FLOAT(_CameraDepthTexture); +SAMPLER(sampler_CameraDepthTexture); + +float HighPrecisionSampleSceneDepth(float2 uvStereo) +{ + return SAMPLE_TEXTURE2D_X(_CameraDepthTexture, sampler_CameraDepthTexture, uvStereo).r; +} + + +#if BEAUTIFY_ORTHO + #if UNITY_REVERSED_Z + #define BEAUTIFY_GET_DEPTH_01(x) (1.0-x) + #define BEAUTIFY_GET_DEPTH_EYE(x) ((1.0-x) * _ProjectionParams.z) + + #define BEAUTIFY_GET_SCENE_DEPTH_01(x) (1.0 - HighPrecisionSampleSceneDepth(x)) + #define BEAUTIFY_GET_SCENE_DEPTH_EYE(x) ((1.0 - HighPrecisionSampleSceneDepth(x)) * _ProjectionParams.z) + + #define BEAUTIFY_GET_CUSTOM_DEPTH_01(s, x) (1.0 - SAMPLE_TEXTURE2D_X(s, sampler_PointClamp, x).r) + #else + #define BEAUTIFY_GET_DEPTH_01(x) (x) + #define BEAUTIFY_GET_DEPTH_EYE(x) (x * _ProjectionParams.z) + + #define BEAUTIFY_GET_SCENE_DEPTH_01(x) HighPrecisionSampleSceneDepth(x) + #define BEAUTIFY_GET_SCENE_DEPTH_EYE(x) (HighPrecisionSampleSceneDepth(x) * _ProjectionParams.z) + + #define BEAUTIFY_GET_CUSTOM_DEPTH_01(s, x) SAMPLE_TEXTURE2D_X(s, sampler_PointClamp, x).r + #endif +#else + #define BEAUTIFY_GET_DEPTH_01(x) Linear01Depth(x, _ZBufferParams) + #define BEAUTIFY_GET_DEPTH_EYE(x) LinearEyeDepth(x, _ZBufferParams) + + #define BEAUTIFY_GET_SCENE_DEPTH_01(x) Linear01Depth(HighPrecisionSampleSceneDepth(x), _ZBufferParams) + #define BEAUTIFY_GET_SCENE_DEPTH_EYE(x) LinearEyeDepth(HighPrecisionSampleSceneDepth(x), _ZBufferParams) + + #define BEAUTIFY_GET_CUSTOM_DEPTH_01(s, x) Linear01Depth(SAMPLE_TEXTURE2D_X(s, sampler_PointClamp, x).r, _ZBufferParams) +#endif + + +// Base for COC - required for Android +#define COC_BASE 128 + + +// Optimization for SSPR +#define uvN uv1 +#define uvE uv2 +#define uvW uv3 +#define uvS uv4 + + +#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) || defined(SINGLE_PASS_STEREO) + #define BEAUTIFY_VERTEX_CROSS_UV_DATA + #define BEAUTIFY_VERTEX_OUTPUT_CROSS_UV(o) + #define BEAUTIFY_VERTEX_OUTPUT_GAUSSIAN_UV(o) + + #define BEAUTIFY_FRAG_SETUP_CROSS_UV(i) float3 uvInc = float3(_MainTex_TexelSize.x, _MainTex_TexelSize.y, 0); float2 uvN = i.uv + uvInc.zy; float2 uvE = i.uv + uvInc.xz; float2 uvW = i.uv - uvInc.xz; float2 uvS = i.uv - uvInc.zy; + + #if defined(BEAUTIFY_BLUR_HORIZ) + #define BEAUTIFY_FRAG_SETUP_GAUSSIAN_UV(i) float2 inc = float2(_MainTex_TexelSize.x * 1.3846153846 * _BlurScale, 0); float2 uv1 = i.uv - inc; float2 uv2 = i.uv + inc; float2 inc2 = float2(_MainTex_TexelSize.x * 3.2307692308 * _BlurScale, 0); float2 uv3 = i.uv - inc2; float2 uv4 = i.uv + inc2; + #else + #define BEAUTIFY_FRAG_SETUP_GAUSSIAN_UV(i) float2 inc = float2(0, _MainTex_TexelSize.y * 1.3846153846 * _BlurScale); float2 uv1 = i.uv - inc; float2 uv2 = i.uv + inc; float2 inc2 = float2(0, _MainTex_TexelSize.y * 3.2307692308 * _BlurScale); float2 uv3 = i.uv - inc2; float2 uv4 = i.uv + inc2; + #endif + +#else + #define BEAUTIFY_VERTEX_CROSS_UV_DATA float2 uvN : TEXCOORD1; float2 uvW: TEXCOORD2; float2 uvE: TEXCOORD3; float2 uvS: TEXCOORD4; + + #define BEAUTIFY_VERTEX_OUTPUT_CROSS_UV(o) float3 uvInc = float3(_MainTex_TexelSize.x, _MainTex_TexelSize.y, 0); o.uvN = o.uv + uvInc.zy; o.uvE = o.uv + uvInc.xz; o.uvW = o.uv - uvInc.xz; o.uvS = o.uv - uvInc.zy; + #define BEAUTIFY_FRAG_SETUP_CROSS_UV(i) float2 uv1 = i.uv1; float2 uv2 = i.uv2; float2 uv3 = i.uv3; float2 uv4 = i.uv4; + + #if defined(BEAUTIFY_BLUR_HORIZ) + #define BEAUTIFY_VERTEX_OUTPUT_GAUSSIAN_UV(o) float2 inc = float2(_MainTex_TexelSize.x * 1.3846153846 * _BlurScale, 0); o.uv1 = o.uv - inc; o.uv2 = o.uv + inc; float2 inc2 = float2(_MainTex_TexelSize.x * 3.2307692308 * _BlurScale, 0); o.uv3 = o.uv - inc2; o.uv4 = o.uv + inc2; + #else + #define BEAUTIFY_VERTEX_OUTPUT_GAUSSIAN_UV(o) float2 inc = float2(0, _MainTex_TexelSize.y * 1.3846153846 * _BlurScale); o.uv1 = o.uv - inc; o.uv2 = o.uv + inc; float2 inc2 = float2(0, _MainTex_TexelSize.y * 3.2307692308 * _BlurScale); o.uv3 = o.uv - inc2; o.uv4 = o.uv + inc2; + #endif + #define BEAUTIFY_FRAG_SETUP_GAUSSIAN_UV(i) float2 uv1 = i.uv1; float2 uv2 = i.uv2; float2 uv3 = i.uv3; float2 uv4 = i.uv4; + +#endif + + +#if BEAUTIFY_TURBO + #define GAMMA_TO_LINEAR(x) FastSRGBToLinear(x) + #define LINEAR_TO_GAMMA(x) FastLinearToSRGB(x) +#else + #define GAMMA_TO_LINEAR(x) SRGBToLinear(x) + #define LINEAR_TO_GAMMA(x) LinearToSRGB(x) +#endif + + +// Common functions + +float _FlipY; + +struct AttributesSimple +{ + float4 positionOS : POSITION; + float2 uv : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + + +struct VaryingsSimple +{ + float4 positionCS : SV_POSITION; + float2 uv : TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO +}; + +VaryingsSimple VertOS(AttributesSimple input) { + VaryingsSimple output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + output.positionCS = input.positionOS; + output.positionCS.y *= _ProjectionParams.x * _FlipY; + output.uv = input.uv; + return output; +} + + +inline float getLuma(float3 rgb) { + //const float3 lum = float3(0.2627, 0.6780, 0.0593); // Rec.2020 (HDR/wide gamut) + //const float3 lum = float3(0.2126, 0.7152, 0.0722); // Rec709 (sRGB/HD) + const float3 lum = float3(0.299, 0.587, 0.114); // Rec601 (SD/broadcast) + return dot(rgb, lum); +} + + +inline float3 getNormal(float depth, float depth1, float depth2, float2 offset1, float2 offset2) { + float3 p1 = float3(offset1, depth1 - depth); + float3 p2 = float3(offset2, depth2 - depth); + float3 normal = cross(p1, p2); + return normalize(normal); +} + +inline float getSaturation(float3 rgb) { + float maxVal = max(max(rgb.r, rgb.g), rgb.b); + float minVal = min(min(rgb.r, rgb.g), rgb.b); + float delta = maxVal - minVal; + if (maxVal == 0.0) return 0; + return delta / maxVal; +} + +#endif // __BEAUTIFY_COMMON_INCLUDE \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCommon.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCommon.hlsl.meta new file mode 100644 index 00000000..3b11c0b3 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCommon.hlsl.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 911431f45704646a990da305cf54bd45 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.hlsl new file mode 100644 index 00000000..6364bb0e --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.hlsl @@ -0,0 +1,575 @@ +#ifndef BEAUTIFY_CORE_FX +#define BEAUTIFY_CORE_FX + +#pragma warning (disable : 3571) + + TEXTURE2D_X(_MainTex); + SAMPLER(sampler_MainTex); + float4 _MainTex_TexelSize; + + #include "BeautifyACESFitted.hlsl" + #include "BeautifyAGX.hlsl" + #include "BeautifyColorTemp.hlsl" + #include "BeautifyDistortion.hlsl" + #include "BeautifyCommon.hlsl" + #include "BeautifyPPSFilmGrain.hlsl" + + // Copyright 2020-2021 Ramiro Oliva (Kronnect) - All Rights Reserved. + float4 _CompareParams; + TEXTURE2D_X(_CompareTex); + TEXTURE2D_X(_BloomTex); + TEXTURE2D_X(_ScreenLum); + TEXTURE2D(_OverlayTex); + TEXTURE2D(_LUTTex); + TEXTURE3D(_LUT3DTex); + TEXTURE2D_X(_EAHist); + TEXTURE2D_X(_EALumSrc); + TEXTURE2D_X(_BlurTex); + TEXTURE2D(_BlurMask); + + TEXTURE2D_X(_MiniViewTex); + float4 _MiniViewRect; + float4 _MiniViewBlend; + + float4 _Params; + float4 _Sharpen; + float4 _Bloom; + float4 _Dirt; // x = brightness based, y = intensity, z = threshold, w = bloom contribution + float4 _FXColor; + float4 _ColorBoost; + float4 _TintColor; + float4 _Purkinje; + float4 _EyeAdaptation; + float4 _EyeAdaptation2; // x: center weight, y: min camera distance, z: middle gray, w: unused + float4 _BokehData; + float4 _BokehData2; + float3 _BokehData3; + + float4 _Outline; + #define OUTLINE_EDGE_THRESHOLD _Outline.a + + float4 _OutlineData; + #define OUTLINE_INTENSITY_MULTIPLIER _OutlineData.x + #define OUTLINE_DISTANCE_FADE _OutlineData.y + #define OUTLINE_MIN_DEPTH_THRESHOLD _OutlineData.z + #define OUTLINE_MIN_SATURATION_THRESHOLD _OutlineData.w + + float3 _ColorTemp; + float4 _NightVision; + float2 _NightVisionDepth; + float4 _LUTTex_TexelSize; + float2 _LUT3DParams; + + #if BEAUTIFY_VIGNETTING || BEAUTIFY_VIGNET_MASK + float4 _Vignetting; + float4 _VignettingData; + float _VignettingData2; + #define VIGNETTE_ASPECT_RATIO_Y _VignettingData.z + #define VIGNETTE_CENTER _VignettingData.xy + #define VIGNETTE_OUTER_RING _VignettingData.w + #define VIGNETTE_FADE_AND_BLINK _Purkinje.z + #define VIGNETTE_INNER_RING _Purkinje.w + #define VIGNETTE_ASPECT_RATIO_X _VignettingData2 + TEXTURE2D_X(_VignettingMask); + #endif + + #if BEAUTIFY_FRAME + TEXTURE2D_X(_FrameMask); + float4 _Frame; + float4 _FrameData; + #endif + + #if BEAUTIFY_DOF_TRANSPARENT || BEAUTIFY_DEPTH_OF_FIELD + TEXTURE2D_X(_DoFTex); + float4 _DoFTex_TexelSize; + #endif + #if BEAUTIFY_DOF_TRANSPARENT + TEXTURE2D_X(_DoFTransparentDepth); + //TEXTURE2D_X(_DofExclusionTexture; + #endif + + #if defined(BEAUTIFY_EDGE_AA) + float4 _AntialiasData; + #define ANTIALIAS_STRENGTH _AntialiasData.x + #define ANTIALIAS_THRESHOLD _AntialiasData.y + #define ANTIALIAS_DEPTH_ATTEN _AntialiasData.z + #define ANTIALIAS_CLAMP _AntialiasData.w + #endif + + #if BEAUTIFY_EXCLUSION_MASK_SHARPEN + TEXTURE2D_X(_SharpenExclusionMask); + #endif + + + struct VaryingsBeautify { + float4 positionCS : SV_POSITION; + float2 uv : TEXCOORD0; + BEAUTIFY_VERTEX_CROSS_UV_DATA + UNITY_VERTEX_OUTPUT_STEREO + }; + + + VaryingsBeautify VertBeautify(AttributesSimple input) { + VaryingsBeautify output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + output.positionCS = input.positionOS; + output.positionCS.y *= _ProjectionParams.x * _FlipY; + output.uv = input.uv.xy; + BEAUTIFY_VERTEX_OUTPUT_CROSS_UV(output) + return output; + } + + + float getRandom(float2 uv) { + return frac(sin(_Time.y + dot(uv, float2(12.9898, 78.233)))* 43758.5453); + } + + + float getCoc(VaryingsBeautify i) { + #if BEAUTIFY_DOF_TRANSPARENT + float depthTex = BEAUTIFY_GET_CUSTOM_DEPTH_01(_DoFTransparentDepth, i.uv); + //float exclusionDepth = DecodeFloatRGBA(SAMPLE_TEXTURE2D_LOD(_DofExclusionTexture, sampler_DoFExclusionTexture, i.uv, 0)); + float depth = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv); + depth = min(depth, depthTex); + //if (exclusionDepth < depth) return 0; + depth *= _ProjectionParams.z; + #else + float depth = BEAUTIFY_GET_SCENE_DEPTH_EYE(i.uv); + #endif + float xd = abs(depth - _BokehData.x) - _BokehData2.x * (depth < _BokehData.x); + return min(_BokehData3.z, 0.5 * _BokehData.y * xd/depth); // radius of CoC + } + + float3 tmoFilmicACES(float3 x) { + const float A = 2.51; + const float B = 0.03; + const float C = 2.43; + const float D = 0.59; + const float E = 0.14; + return (x * (A * x + B) ) / (x * (C * x + D) + E); + } + + void beautifyPass(VaryingsBeautify i, inout float3 rgbM) { + + #if BEAUTIFY_ACES_TONEMAP || BEAUTIFY_AGX_TONEMAP || BEAUTIFY_ACES_FITTED_TONEMAP + rgbM = clamp(rgbM, 0, _FXColor.z); + #endif + + float2 uv = i.uv; + BEAUTIFY_FRAG_SETUP_CROSS_UV(i) + + float depthS = BEAUTIFY_GET_SCENE_DEPTH_01(uvS); + float depthW = BEAUTIFY_GET_SCENE_DEPTH_01(uvW); + float depthE = BEAUTIFY_GET_SCENE_DEPTH_01(uvE); + float depthN = BEAUTIFY_GET_SCENE_DEPTH_01(uvN); + + // neighbour depth analysis + float maxDepth = max(depthN, depthS); + maxDepth = max(maxDepth, depthW); + maxDepth = max(maxDepth, depthE); + float minDepth = min(depthN, depthS); + minDepth = min(minDepth, depthW); + minDepth = min(minDepth, depthE); + float dDepth = maxDepth - minDepth + 0.000001; + + // luma analysis + float3 rgbS = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uvS).rgb; + float3 rgbW = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uvW).rgb; + float3 rgbE = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uvE).rgb; + float3 rgbN = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uvN).rgb; + + float lumaN = getLuma(rgbN); + float lumaE = getLuma(rgbE); + float lumaW = getLuma(rgbW); + float lumaS = getLuma(rgbS); + + float maxLuma = max(lumaN,lumaS); + maxLuma = max(maxLuma, lumaW); +#if !BEAUTIFY_TURBO + maxLuma = max(maxLuma, lumaE); +#endif + float minLuma = min(lumaN,lumaS); + minLuma = min(minLuma, lumaW); +#if !BEAUTIFY_TURBO + minLuma = min(minLuma, lumaE); +#endif + minLuma -= 0.000001; + +#if BEAUTIFY_EDGE_AA + if (dDepth > ANTIALIAS_THRESHOLD) { + float2 n = float2(lumaN - lumaS, lumaW - lumaE); + n *= ANTIALIAS_STRENGTH; + n = clamp(n, -ANTIALIAS_CLAMP, ANTIALIAS_CLAMP); + float antialiasDepthAtten = 1.0 - saturate(depthN * ANTIALIAS_DEPTH_ATTEN); + n *= _MainTex_TexelSize.xy * antialiasDepthAtten; + float3 rgbA = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv - n * 0.166667).rgb + SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv + n * 0.166667).rgb; + float3 rgbB = 0.25 * (rgbA + SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv - n * 0.5).rgb + SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv + n * 0.5).rgb); + float lumaB = getLuma(rgbB); + if (lumaB < minLuma || lumaB > maxLuma) rgbB = rgbA * 0.5; + rgbM = rgbB; + } +#endif + + float lumaM = getLuma(rgbM); + + // daltonize + #if BEAUTIFY_COLOR_TWEAKS + float3 rgb0 = 1.0.xxx - saturate(rgbM.rgb); + rgbM.r *= 1.0 + rgbM.r * rgb0.g * rgb0.b * _Params.y; + rgbM.g *= 1.0 + rgbM.g * rgb0.r * rgb0.b * _Params.y; + rgbM.b *= 1.0 + rgbM.b * rgb0.r * rgb0.g * _Params.y; + rgbM *= lumaM / (getLuma(rgbM) + 0.0001); + #endif + + // sharpen +#if BEAUTIFY_TURBO + const float lumaDepth = 1.0; +#else + float lumaDepth = saturate( _Sharpen.y / dDepth); +#endif + + float lumaPower = 2.0 * lumaM - minLuma - maxLuma; + float lumaAtten = saturate(_Sharpen.w / (maxLuma - minLuma)); +#if BEAUTIFY_TURBO + const float depthClamp = 1.0; +#else + float depthClamp = abs(depthW - _Params.z) < _Params.w; +#endif + +#if BEAUTIFY_SHARPEN || BEAUTIFY_EXCLUSION_MASK_SHARPEN + float sharpenAmount = clamp(lumaPower * lumaAtten * lumaDepth * _Sharpen.x, -_Sharpen.z, _Sharpen.z) * depthClamp; + #if BEAUTIFY_EXCLUSION_MASK_SHARPEN + float3 sharpenMask = SAMPLE_TEXTURE2D_X(_SharpenExclusionMask, sampler_LinearClamp, i.uv).rgb; + if (any(sharpenMask != 0)) sharpenAmount = 0; + #endif + rgbM *= 1.0 + sharpenAmount; +#endif + + #if BEAUTIFY_DEPTH_OF_FIELD || BEAUTIFY_DOF_TRANSPARENT + float4 dofPix = SAMPLE_TEXTURE2D_X(_DoFTex, sampler_LinearClamp, i.uv); + #if UNITY_COLORSPACE_GAMMA + dofPix.rgb = LINEAR_TO_GAMMA(dofPix.rgb); + #endif + if (_DoFTex_TexelSize.z < _MainTex_TexelSize.z) { + float CoC = getCoc(i) / COC_BASE; + dofPix.a = lerp(CoC, dofPix.a, _DoFTex_TexelSize.z / _MainTex_TexelSize.z); + } + rgbM = lerp(rgbM, dofPix.rgb, saturate(dofPix.a * COC_BASE)); + #endif + + #if BEAUTIFY_NIGHT_VISION || (BEAUTIFY_OUTLINE && !BEAUTIFY_OUTLINE_SOBEL) + float3 uvNormalDisp = float3(_MainTex_TexelSize.x, _MainTex_TexelSize.y, 0); + float depth = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv); + float3 normalNW = getNormal(depth, depthN, depthW, uvNormalDisp.zy, float2(-uvNormalDisp.x, -uvNormalDisp.z)); + #endif + + #if BEAUTIFY_OUTLINE + #if !BEAUTIFY_OUTLINE_SOBEL + float3 normalSE = getNormal(depth, depthS, depthE, -uvNormalDisp.zy, uvNormalDisp.xz); + float dnorm = dot(normalNW, normalSE); + float satN = getSaturation(rgbN); + float satS = getSaturation(rgbS); + float satW = getSaturation(rgbW); + float satE = getSaturation(rgbE); + float maxSat = max( max(satN, satS), max(satW, satE) ); + float minSat = min( min(satN, satS), min(satW, satE) ); + float dSat = maxSat - minSat; + rgbM = lerp(rgbM, _Outline.rgb, (float)(dnorm < OUTLINE_EDGE_THRESHOLD && dDepth > OUTLINE_MIN_DEPTH_THRESHOLD && dSat > OUTLINE_MIN_SATURATION_THRESHOLD)); + #else + float3 uvInc = float3(_MainTex_TexelSize.x, _MainTex_TexelSize.y, 0); + float3 rgbSW = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv - uvInc.xy).rgb; // was tex2Dlod + float3 rgbNE = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv + uvInc.xy).rgb; + float3 rgbSE = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv + float2( uvInc.x, -uvInc.y)).rgb; + float3 rgbNW = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv + float2(-uvInc.x, uvInc.y)).rgb; + float3 gx = rgbSW * -1.0; + gx += rgbSE * 1.0; + gx += rgbW * -2.0; + gx += rgbE * 2.0; + gx += rgbNW * -1.0; + gx += rgbNE * 1.0; + float3 gy = rgbSW * -1.0; + gy += rgbS * -2.0; + gy += rgbSE * -1.0; + gy += rgbNW * 1.0; + gy += rgbN * 2.0; + gy += rgbNE * 1.0; + float olColor = (length(gx * gx + gy * gy) - _Outline.a) > 0.0; + rgbM = lerp(rgbM, _Outline.rgb, olColor); + #endif + #endif + + #if UNITY_COLORSPACE_GAMMA && (BEAUTIFY_BLOOM || BEAUTIFY_NIGHT_VISION || BEAUTIFY_THERMAL_VISION || BEAUTIFY_DIRT || BEAUTIFY_EYE_ADAPTATION || BEAUTIFY_PURKINJE || BEAUTIFY_ACES_TONEMAP || BEAUTIFY_AGX_TONEMAP || BEAUTIFY_ACES_FITTED_TONEMAP) + rgbM = GAMMA_TO_LINEAR(rgbM); + #endif + + #if BEAUTIFY_BLOOM + rgbM += SAMPLE_TEXTURE2D_X(_BloomTex, sampler_LinearClamp, i.uv).rgb * _Bloom.xxx; + #endif + + #if BEAUTIFY_DIRT + float3 scrLum = SAMPLE_TEXTURE2D_X(_ScreenLum, sampler_LinearClamp, i.uv).rgb; + #if BEAUTIFY_BLOOM + scrLum *= _Dirt.www; + #endif + + #if defined(UNITY_SINGLE_PASS_STEREO) + float2 dirtUV = float2(uv.x * 2.0, uv.y); // TODO: ?? should ignore Single Pass + #else + float2 dirtUV = uv; + #endif + float4 dirt = SAMPLE_TEXTURE2D(_OverlayTex, sampler_LinearRepeat, dirtUV); + rgbM += saturate(0.5.xxx - _Dirt.zzz + scrLum) * dirt.rgb * _Dirt.y; + #endif + + #if BEAUTIFY_NIGHT_VISION + rgbM *= saturate( (_NightVisionDepth.x - BEAUTIFY_GET_SCENE_DEPTH_EYE(uv)) * _NightVisionDepth.y ); + lumaM = getLuma(rgbM); // updates luma + float nvbase = saturate(normalNW.z - 0.8); // minimum ambient self radiance (useful for pitch black) + nvbase += lumaM; // adds current lighting + nvbase *= nvbase * (0.5 + nvbase); // increase contrast + rgbM = nvbase * _NightVision.rgb; + rgbM *= frac(floor(uv.y * _MainTex_TexelSize.w)*0.25)>0.4; // scan lines + rgbM *= 1.0 + getRandom(uv) * 0.3 - 0.15; // noise + #endif + + #if BEAUTIFY_THERMAL_VISION + lumaM = getLuma(rgbM); // updates luma + float3 tv0 = lerp(float3(0.0,0.0,1.0), float3(1.0,1.0,0.0), lumaM * 2.0); + float3 tv1 = lerp(float3(1.0,1.0,0.0), float3(1.0,0.0,0.0), lumaM * 2.0 - 1.0); + rgbM = lerp(tv0, tv1, (float)(lumaM >= 0.5)); + rgbM *= 0.2 + frac(floor(uv.y * _MainTex_TexelSize.w)*0.25)>_NightVision.a; // scan lines + rgbM *= 1.0 + getRandom(uv) * 0.2 - 0.1; // noise + #endif + + #if BEAUTIFY_EYE_ADAPTATION || BEAUTIFY_PURKINJE + float4 avgLum = SAMPLE_TEXTURE2D_X(_EAHist, sampler_LinearClamp, 0.5.xx); + #endif + + #if BEAUTIFY_EYE_ADAPTATION + float eaFactor; + #if BEAUTIFY_EA_LEGACY_MODE + float srcLum = SAMPLE_TEXTURE2D_X(_EALumSrc, sampler_LinearClamp, 0.5.xx).r; + float eaLuma = getLuma(rgbM); + float pixLum = max(0, log(1.0 + eaLuma)); + static const float epsilon = 1e-4; + float avgLumSafe = max(avgLum.r, epsilon); + eaFactor = pow(pixLum / avgLumSafe, abs(srcLum / avgLumSafe - 1.0)); + #else + float histLum = exp(avgLum.r) - 1.0 + 0.001; + float middleGray = _EyeAdaptation2.z; + eaFactor = middleGray / histLum; + #endif + eaFactor = clamp(eaFactor, _EyeAdaptation.x, _EyeAdaptation.y); + rgbM *= eaFactor; + #endif + + #if BEAUTIFY_AGX_TONEMAP + rgbM *= _FXColor.r; + rgbM = AGXFitted(rgbM); // already applies gamma correction + rgbM *= _FXColor.g; + rgbM = saturate(rgbM); + #else + #if BEAUTIFY_ACES_FITTED_TONEMAP + rgbM *= _FXColor.r; + rgbM = ACESFitted(rgbM); + rgbM *= _FXColor.g; + #endif + #if BEAUTIFY_ACES_TONEMAP + rgbM *= _FXColor.r; + rgbM = tmoFilmicACES(rgbM); + rgbM *= _FXColor.g; + #endif + #if UNITY_COLORSPACE_GAMMA && (BEAUTIFY_BLOOM || BEAUTIFY_NIGHT_VISION || BEAUTIFY_THERMAL_VISION || BEAUTIFY_DIRT || BEAUTIFY_EYE_ADAPTATION || BEAUTIFY_PURKINJE || BEAUTIFY_ACES_FITTED_TONEMAP || BEAUTIFY_ACES_TONEMAP) + rgbM = LINEAR_TO_GAMMA(rgbM); + #endif + #endif + + #if BEAUTIFY_LUT || BEAUTIFY_3DLUT + #if !UNITY_COLORSPACE_GAMMA + rgbM = LINEAR_TO_GAMMA(rgbM); + #endif + #if BEAUTIFY_3DLUT + float3 xyz = rgbM * _LUT3DParams.y + _LUT3DParams.x; + float3 lut = SAMPLE_TEXTURE3D(_LUT3DTex, sampler_LinearClamp, xyz).rgb; + #else + float3 lutST = float3(_LUTTex_TexelSize.x, _LUTTex_TexelSize.y, _LUTTex_TexelSize.w - 1); + float3 lookUp = saturate(rgbM) * lutST.zzz; + lookUp.xy = lutST.xy * (lookUp.xy + 0.5); + float slice = floor(lookUp.z); + lookUp.x += slice * lutST.y; + float2 lookUpNextSlice = float2(lookUp.x + lutST.y, lookUp.y); + float3 lut = lerp(SAMPLE_TEXTURE2D(_LUTTex, sampler_LinearClamp, lookUp.xy).rgb, SAMPLE_TEXTURE2D(_LUTTex, sampler_LinearClamp, lookUpNextSlice).rgb, lookUp.z - slice); + #endif + rgbM = lerp(rgbM, lut, _FXColor.a); + + #if !UNITY_COLORSPACE_GAMMA + rgbM = GAMMA_TO_LINEAR(rgbM); + #endif + #endif + + + // sepia + #if BEAUTIFY_COLOR_TWEAKS + float3 sepia = float3( + dot(rgbM, float3(0.393, 0.769, 0.189)), + dot(rgbM, float3(0.349, 0.686, 0.168)), + dot(rgbM, float3(0.272, 0.534, 0.131)) + ); + rgbM = lerp(rgbM, sepia, _Params.x); + #endif + + // saturate + float maxComponent = max(rgbM.r, max(rgbM.g, rgbM.b)); + float minComponent = min(rgbM.r, min(rgbM.g, rgbM.b)); + float sat = saturate(maxComponent - minComponent); + rgbM *= 1.0 + _ColorBoost.z * (1.0 - sat) * (rgbM - getLuma(rgbM)); + rgbM = lerp(rgbM, rgbM * _TintColor.rgb, _TintColor.a); + rgbM = (rgbM - 0.5.xxx) * _ColorBoost.y + 0.5.xxx; + rgbM *= _ColorBoost.x; + + #if BEAUTIFY_COLOR_TWEAKS + lumaM = getLuma(rgbM); + float3 kelvin = KelvinToRGB(_ColorTemp.x); + rgbM = lerp(rgbM, rgbM * kelvin, _ColorTemp.y); + //rgbM *= getLuma(rgbM) / lumaM; // energy preservation (optional) + #endif + + #if BEAUTIFY_PURKINJE + lumaM = getLuma(rgbM); + float3 shifted = saturate(float3(lumaM / (1.0 + _Purkinje.x * 1.14), lumaM, lumaM * (1.0 + _Purkinje.x * 2.99))); + rgbM = lerp(shifted, rgbM, saturate(exp(avgLum.g) - _Purkinje.y)); + #endif + + // Film Grain + #if BEAUTIFY_FILM_GRAIN + ApplyFilmGrain(rgbM, lumaM, uv); + #endif + +#if BEAUTIFY_VIGNETTING + float2 vd = float2((uv.x - VIGNETTE_CENTER.x) * VIGNETTE_ASPECT_RATIO_X, (uv.y - VIGNETTE_CENTER.y) * VIGNETTE_ASPECT_RATIO_Y); + float3 vcolor = lerp(_Vignetting.rgb, rgbM, saturate( saturate((dot(vd, vd) - VIGNETTE_OUTER_RING) / (VIGNETTE_INNER_RING - VIGNETTE_OUTER_RING) ) - VIGNETTE_FADE_AND_BLINK)) ; + rgbM = lerp(rgbM, vcolor, _Vignetting.a); +#elif BEAUTIFY_VIGNET_MASK + float2 vd = float2((uv.x - VIGNETTE_CENTER.x) * VIGNETTE_ASPECT_RATIO_X, (uv.y - VIGNETTE_CENTER.y) * VIGNETTE_ASPECT_RATIO_Y); + float vmask = SAMPLE_TEXTURE2D_X(_VignettingMask, sampler_LinearClamp, uv).a; + rgbM = lerp(rgbM, lumaM * _Vignetting.rgb, saturate(VIGNETTE_FADE_AND_BLINK + vmask * _Vignetting.a * saturate(VIGNETTE_OUTER_RING * 4.0 * dot(vd, vd)))); +#endif + +#if BEAUTIFY_FRAME + float aspectRatio = _MainTex_TexelSize.z / _MainTex_TexelSize.w; + float2 distToEdge = min(i.uv.xy, 1.0 - i.uv.xy); + distToEdge.x *= aspectRatio; + float thickness = _FrameData.x; + float frameIntensity = saturate( (thickness - min(distToEdge.x, distToEdge.y)) * _FrameData.y ); + + float2 bands = saturate( (abs(i.uv.xy - 0.5) - _FrameData.xz) * _FrameData.yw); + float bandsIntensity = max(bands.x, bands.y); + + frameIntensity = _FrameData.w > 0 ? bandsIntensity : frameIntensity; + + float4 frameMask = SAMPLE_TEXTURE2D_X(_FrameMask, sampler_LinearClamp, uv); + rgbM = lerp(rgbM, _Frame.rgb * frameMask.rgb, frameMask.a * _Frame.a * frameIntensity); +#endif + +#if BEAUTIFY_DITHER + #if BEAUTIFY_TURBO + float3 dither = dot(float2(171.0, 231.0), i.uv * _MainTex_TexelSize.zw).xxx; + dither = frac(dither / float3(103.0, 71.0, 97.0)) - 0.5.xxx; + rgbM += dither * _ColorBoost.w; + #else + float2 noiseUV = i.uv * _BlueNoise_TexelSize.xy * _MainTex_TexelSize.zw; + float3 blueNoise = SAMPLE_TEXTURE2D(_BlueNoise, sampler_PointRepeat, noiseUV).rgb; + rgbM += (blueNoise - 0.5.xxx) * _ColorBoost.w * saturate(1.0 - lumaM); + #endif + rgbM = max(0.0.xxx, rgbM); +#endif + + } + + float4 FragBeautify (VaryingsBeautify i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + #if BEAUTIFY_THERMAL_VISION + i.uv.x += _NightVision.z * sin(_Time.z + i.uv.y * 20.0) / (1.0 + 10.0 * dot(i.uv - 0.5.xx, i.uv.xy - 0.5.xx)); // wave animation + #endif + + #if BEAUTIFY_CABERRATION + float4 pixel = GetDistortedColor(i.uv); + #else + float4 pixel = SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, i.uv); + #endif + + beautifyPass(i, pixel.rgb); + + return pixel; + } + + + float4 FragCompare (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + // separator line + antialias + float2 dd = i.uv; + if (_CompareParams.z < -15) { + dd.x -= (_CompareParams.z - -20); + _CompareParams.z = -10; + } else { + dd.x -= 0.5; + } + dd.y -= 0.5; + + float co = dot(_CompareParams.xy, dd); + float dist = distance( _CompareParams.xy * co, dd ); + float4 aa = saturate( (_CompareParams.w - dist) / abs(_MainTex_TexelSize.y) ); + + float sameSide = (_CompareParams.z > -5); + float2 pixelUV = lerp(i.uv, float2(i.uv.x + _CompareParams.z, i.uv.y), sameSide); + float2 pixelNiceUV = lerp(i.uv, float2(i.uv.x - 0.5 + _CompareParams.z, i.uv.y), sameSide); + float4 pixel = SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, pixelUV); + float4 pixelNice = SAMPLE_TEXTURE2D_X(_CompareTex, sampler_MainTex, pixelNiceUV); + + // are we on the beautified side? + float2 cp = float2(_CompareParams.y, -_CompareParams.x); + float t = dot(dd, cp) > 0; + pixel = lerp(pixel, pixelNice, t); + return pixel + aa; + } + + + half4 FragCopy (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + float2 uv = UnityStereoTransformScreenSpaceTex(i.uv); + #if defined(USE_BILINEAR) + return clamp(SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv), 0, 1e6); + #else + return SAMPLE_TEXTURE2D_X(_MainTex, sampler_PointClamp, uv); + #endif + } + + + half4 FragCopyWithMask (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + float2 uv = UnityStereoTransformScreenSpaceTex(i.uv); + half4 mask = SAMPLE_TEXTURE2D(_BlurMask, sampler_LinearClamp, uv); + half4 srcPixel = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv); + half4 blurPixel = SAMPLE_TEXTURE2D_X(_BlurTex, sampler_LinearClamp, uv); + return lerp(srcPixel, blurPixel, mask.a); + } + + half4 FragCopyWithMiniView (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + float2 uv = UnityStereoTransformScreenSpaceTex(i.uv); + float2 uvOrig = (uv - _MiniViewRect.xy) / _MiniViewRect.zw; + half4 source = SAMPLE_TEXTURE2D_X_LOD(_MiniViewTex, sampler_LinearClamp, uvOrig, 0); + half4 final = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_LinearClamp, uv, 0); + if (any(floor(uvOrig) != 0)) source = final; + float2 frameIntensity = saturate( (abs(uvOrig - 0.5) - _MiniViewBlend.xz) * _MiniViewBlend.yw); + float frameBlend = max(frameIntensity.x, frameIntensity.y); + return lerp(source, final, frameBlend); + } + + +#endif // BEAUTIFY_CORE_FX \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.hlsl.meta new file mode 100644 index 00000000..de89c0d3 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.hlsl.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 850a3a451a0484244acec510bfdf6867 +timeCreated: 1517506872 +licenseType: Pro +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.shader b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.shader new file mode 100644 index 00000000..b4b946e4 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.shader @@ -0,0 +1,486 @@ +Shader "Hidden/Kronnect/Beautify" { +Properties { + _FlareTex("Flare Texture", 2D) = "white" {} + _OverlayTex("Lens Dirt Texture", 2D) = "black" {} + _Color("", Color) = (1,1,1) + _BlueNoise("Blue Noise", 2D) = "black" {} + _BokehData2("", Vector) = (1,1,1,1) + _BokehData3("", Vector) = (1,1,1000,1) + _BlurMask("Blur Mask", 2D) = "white" {} + _FlipY("Flip Y", Float) = 1 +} + +Subshader { + + Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" } + LOD 100 + ZWrite Off ZTest Always Blend Off Cull Off + + HLSLINCLUDE + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/Common.hlsl" + ENDHLSL + + Pass { // 0 + Name "Raw Copy (Point Filtering)" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragCopy + #include "BeautifyCore.hlsl" + ENDHLSL + } + + Pass { // 1 + Name "Compare View" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragCompare + #include "BeautifyCore.hlsl" + ENDHLSL + } + + Pass { // 2 + Name "Main Beautify Pass (core)" + HLSLPROGRAM + #pragma vertex VertBeautify + #pragma fragment FragBeautify + #pragma multi_compile_local_fragment __ BEAUTIFY_ACES_TONEMAP BEAUTIFY_ACES_FITTED_TONEMAP BEAUTIFY_AGX_TONEMAP + #pragma multi_compile_local_fragment __ BEAUTIFY_LUT BEAUTIFY_3DLUT BEAUTIFY_NIGHT_VISION BEAUTIFY_THERMAL_VISION + #pragma multi_compile_local_fragment __ BEAUTIFY_BLOOM + #pragma multi_compile_local_fragment __ BEAUTIFY_DIRT + #pragma multi_compile_local_fragment __ BEAUTIFY_DEPTH_OF_FIELD BEAUTIFY_DOF_TRANSPARENT BEAUTIFY_CABERRATION + #pragma multi_compile_local_fragment __ BEAUTIFY_PURKINJE + #pragma multi_compile_local_fragment __ BEAUTIFY_VIGNETTING BEAUTIFY_VIGNET_MASK + #pragma multi_compile_local_fragment __ BEAUTIFY_EYE_ADAPTATION + #pragma multi_compile_local_fragment __ BEAUTIFY_COLOR_TWEAKS + #pragma multi_compile_local_fragment __ BEAUTIFY_TURBO + #pragma multi_compile_local_fragment __ BEAUTIFY_DITHER BEAUTIFY_FILM_GRAIN + #pragma multi_compile_local_fragment __ BEAUTIFY_SHARPEN BEAUTIFY_EXCLUSION_MASK_SHARPEN + #pragma multi_compile_local_fragment __ BEAUTIFY_FRAME + #pragma multi_compile_local_fragment __ BEAUTIFY_EDGE_AA BEAUTIFY_OUTLINE + #include "BeautifyCore.hlsl" + ENDHLSL + } + + Pass { // 3 + Name "Extract Luminance" + HLSLPROGRAM + #pragma vertex VertLum + #pragma fragment FragLum + #pragma multi_compile_local_fragment __ BEAUTIFY_TURBO + #pragma multi_compile_local_fragment __ BEAUTIFY_BLOOM_USE_DEPTH + #pragma multi_compile_local_fragment __ BEAUTIFY_BLOOM_USE_LAYER BEAUTIFY_BLOOM_USE_LAYER_INCLUSION + #pragma multi_compile_local_fragment __ BEAUTIFY_BLOOM_PROP_THRESHOLDING + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 4 + Name "Debug bloom" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragDebugBloom + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 5 + Name "Blur horizontally" + HLSLPROGRAM + #pragma vertex VertBlur + #pragma fragment FragBlur + #define BEAUTIFY_BLUR_HORIZ + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 6 + Name "Blur vertically" + HLSLPROGRAM + #pragma vertex VertBlur + #pragma fragment FragBlur + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 7 + Name "Bloom compose" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragBloomCompose + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 8 + Name "Resample" + HLSLPROGRAM + #pragma vertex VertCross + #pragma fragment FragResample + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 9 + Name "Combine resample" + HLSLPROGRAM + #pragma vertex VertCross + #pragma fragment FragResample + #define COMBINE_BLOOM + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 10 + Name "Bloom extract luminance with antiflicker" + HLSLPROGRAM + #pragma vertex VertCrossLum + #pragma fragment FragLumAntiflicker + #pragma multi_compile_local_fragment __ BEAUTIFY_TURBO + #pragma multi_compile_local_fragment __ BEAUTIFY_BLOOM_USE_DEPTH + #pragma multi_compile_local_fragment __ BEAUTIFY_BLOOM_USE_LAYER BEAUTIFY_BLOOM_USE_LAYER_INCLUSION + #pragma multi_compile_local_fragment __ BEAUTIFY_BLOOM_PROP_THRESHOLDING + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 11 + Name "Resample Anamorphic Flares" + HLSLPROGRAM + #pragma vertex VertCross + #pragma fragment FragResampleAF + #define COMBINE_BLOOM + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 12 + Name "Combine AF" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragCombine + #define COMBINE_BLOOM + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 13 + Name "Compute Screen Lum" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragScreenLum + #pragma multi_compile_local_fragment __ BEAUTIFY_EA_USE_DEPTH + #pragma multi_compile_local_fragment __ BEAUTIFY_EA_USE_MASK + #pragma multi_compile_local_fragment __ BEAUTIFY_TURBO + #include "BeautifyPPSEA.hlsl" + ENDHLSL + } + + Pass { // 14 + Name "Reduce Screen Lum" + HLSLPROGRAM + #pragma vertex VertCross + #pragma fragment FragReduceScreenLum + #pragma multi_compile_local_fragment __ BEAUTIFY_EA_USE_DEPTH + #pragma multi_compile_local_fragment __ BEAUTIFY_EA_USE_MASK + #include "BeautifyPPSEA.hlsl" + ENDHLSL + } + + Pass { // 15 + Name "Blend Screen Lum" + Blend SrcAlpha OneMinusSrcAlpha + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragBlendScreenLum + #include "BeautifyPPSEA.hlsl" + ENDHLSL + } + + Pass { // 16 + Name "Simple Blend" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragBlend + #include "BeautifyPPSEA.hlsl" + ENDHLSL + } + + Pass { // 17 + Name "AF Lum" + HLSLPROGRAM + #pragma vertex VertLum + #pragma fragment FragLum + #pragma multi_compile_local_fragment __ BEAUTIFY_TURBO + #pragma multi_compile_local_fragment __ BEAUTIFY_ANAMORPHIC_FLARES_USE_DEPTH + #pragma multi_compile_local_fragment __ BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER_INCLUSION + #pragma multi_compile_local_fragment __ BEAUTIFY_ANAMORPHIC_PROP_THRESHOLDING + #define USE_AF_THRESHOLD + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 18 + Name "AF Lum AntiFlicker" + HLSLPROGRAM + #pragma vertex VertCrossLum + #pragma fragment FragLumAntiflicker + #pragma multi_compile_local_fragment __ BEAUTIFY_TURBO + #pragma multi_compile_local_fragment __ BEAUTIFY_ANAMORPHIC_FLARES_USE_DEPTH + #pragma multi_compile_local_fragment __ BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER_INCLUSION + #pragma multi_compile_local_fragment __ BEAUTIFY_ANAMORPHIC_PROP_THRESHOLDING + #define USE_AF_THRESHOLD + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 19 + Name "Sun Flares" + HLSLPROGRAM + #pragma vertex VertSF + #pragma fragment FragSF + #pragma fragmentoption ARB_precision_hint_fastest + #pragma multi_compile_local_fragment __ BEAUTIFY_SF_USE_GHOSTS + #pragma multi_compile_local_fragment __ BEAUTIFY_SF_OCCLUSION_SIMPLE BEAUTIFY_SF_OCCLUSION_SMOOTH + #include "BeautifyPPSSF.hlsl" + ENDHLSL + } + + Pass { // 20 + Name "Sun Flares Additive" + HLSLPROGRAM + #pragma vertex VertSF + #pragma fragment FragSFAdditive + #pragma fragmentoption ARB_precision_hint_fastest + #pragma multi_compile_local_fragment __ BEAUTIFY_SF_USE_GHOSTS + #pragma multi_compile_local_fragment __ BEAUTIFY_SF_OCCLUSION_SIMPLE BEAUTIFY_SF_OCCLUSION_SMOOTH + #include "BeautifyPPSSF.hlsl" + ENDHLSL + } + + Pass { // 21 + Name "DoF CoC" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragCoC + #pragma fragmentoption ARB_precision_hint_fastest + #pragma multi_compile_local_fragment __ BEAUTIFY_DOF_TRANSPARENT + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 22 + Name "DoF CoC Debug" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragCoCDebug + #pragma fragmentoption ARB_precision_hint_fastest + #pragma multi_compile_local_fragment __ BEAUTIFY_DOF_TRANSPARENT + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 23 + Name "DoF Blur" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragBlur + #pragma fragmentoption ARB_precision_hint_fastest + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 24 + Name "DoF Blur wo/Bokeh" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragBlurNoBokeh + #pragma fragmentoption ARB_precision_hint_fastest + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 25 + Name "DoF Blur Horizontally" + HLSLPROGRAM + #pragma vertex VertBlur + #pragma fragment FragBlurCoC + #pragma fragmentoption ARB_precision_hint_fastest + #define BEAUTIFY_BLUR_HORIZ + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 26 + Name "DoF Blur Vertically" + HLSLPROGRAM + #pragma vertex VertBlur + #pragma fragment FragBlurCoC + #pragma fragmentoption ARB_precision_hint_fastest + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 27 + Name "Raw Copy (Bilinear Filtering)" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragCopy + #define USE_BILINEAR + #include "BeautifyCore.hlsl" + ENDHLSL + } + + Pass { // 28 + Name "Bloom Exclusion Layer Debug" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragDebugBloomExclusionLayer + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 29 + Name "DoF Debug Transparent" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragDoFDebugTransparent + #pragma fragmentoption ARB_precision_hint_fastest + #pragma multi_compile_local_fragment __ BEAUTIFY_DOF_TRANSPARENT + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 30 + Name "Chromatic Aberration Custom Pass" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment fragChromaticAberration + #pragma fragmentoption ARB_precision_hint_fastest + #pragma multi_compile_local_fragment __ BEAUTIFY_TURBO + #define BEAUTIFY_CABERRATION 1 + #include "BeautifyCAberration.hlsl" + ENDHLSL + } + + Pass { // 31 + Name "Outline Detection Pass" + HLSLPROGRAM + #pragma vertex VertOutline + #pragma fragment fragOutline + #pragma fragmentoption ARB_precision_hint_fastest + #pragma multi_compile_local_fragment _ BEAUTIFY_DEPTH_FADE + #pragma multi_compile_local_fragment _ BEAUTIFY_OUTLINE_CUSTOM_DEPTH BEAUTIFY_OUTLINE_OBJECT_ID + #pragma multi_compile_local_fragment _ BEAUTIFY_OUTLINE_MIN_SEPARATION + #pragma multi_compile_local_fragment _ BEAUTIFY_OUTLINE_OUTER_ONLY + #include "BeautifyPPSOutline.hlsl" + ENDHLSL + } + + Pass { // 32 + Name "Outline Blur Horizontally (depth aware)" + HLSLPROGRAM + #pragma vertex VertBlur + #pragma fragment FragBlur + #pragma fragmentoption ARB_precision_hint_fastest + #define BEAUTIFY_BLUR_HORIZ + #include "BeautifyPPSOutline.hlsl" + ENDHLSL + } + + Pass { // 33 + Name "Outline Blur Vertically (depth aware)" + HLSLPROGRAM + #pragma vertex VertBlur + #pragma fragment FragBlur + #pragma fragmentoption ARB_precision_hint_fastest + #include "BeautifyPPSOutline.hlsl" + ENDHLSL + } + + Pass { // 34 + Name "Outline Blend Pass" + Blend SrcAlpha OneMinusSrcAlpha + HLSLPROGRAM + #pragma vertex VertOutline + #pragma fragment FragCopy + #pragma fragmentoption ARB_precision_hint_fastest + #include "BeautifyPPSOutline.hlsl" + ENDHLSL + } + + Pass { // 35 + Name "Mask Blur" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragCopyWithMask + #include "BeautifyCore.hlsl" + ENDHLSL + } + + + Pass { // 36 + Name "DoF Threshold for bokeh" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragThreshold + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 37 + Name "DoF Additive" + Blend One One + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragCopyBokeh + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 38 + Name "DoF Blur bokeh" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragBlurSeparateBokeh + #include "BeautifyPPSDoF.hlsl" + ENDHLSL + } + + Pass { // 39 + Name "Anamorphic Flares Exclusion Layer Debug" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragDebugAnamorphicFlaresExclusionLayer + #include "BeautifyPPSLum.hlsl" + ENDHLSL + } + + Pass { // 40 + Name "Copy with MiniView" + HLSLPROGRAM + #pragma vertex VertOS + #pragma fragment FragCopyWithMiniView + #include "BeautifyCore.hlsl" + ENDHLSL + } + + Pass { // 41 + Name "Sun Flares Occlusion Test" + Blend SrcAlpha OneMinusSrcAlpha + HLSLPROGRAM + #pragma vertex VertSF + #pragma fragment FragSFOcclusion + #pragma multi_compile_local_fragment _ BEAUTIFY_SF_OCCLUSION_INIT + #include "BeautifyPPSSF.hlsl" + ENDHLSL + } +} +FallBack Off +} diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.shader.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.shader.meta new file mode 100644 index 00000000..e50db252 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyCore.shader.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 55d70ca4ea7504a38b66170bbe587b2f +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _FlareTex: {fileID: 2800000, guid: 93092410bbc6f4ccba773578db5832d9, type: 3} + - _OverlayTex: {fileID: 2800000, guid: 0bd567658bec947d2b4d2877ccb0faa7, type: 3} + - _BlueNoise: {fileID: 2800000, guid: e6a467a4c71a24898ac842ed6f9a1d52, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyDistortion.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyDistortion.hlsl new file mode 100644 index 00000000..861f8496 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyDistortion.hlsl @@ -0,0 +1,70 @@ +#ifndef BEAUTIFY_DISTORTION +#define BEAUTIFY_DISTORTION + +#if BEAUTIFY_CABERRATION + +float3 _ChromaticAberrationData; +#define CHROMATIC_ABERRATION_INTENSITY _ChromaticAberrationData.x +#define CHROMATIC_ABERRATION_SMOOTHING _ChromaticAberrationData.y +#define CHROMATIC_ABERRATION_SHIFT _ChromaticAberrationData.z +#define CHROMATIC_ABERRATION_MAX_SAMPLES 32 + +#if BEAUTIFY_TURBO + +float4 GetDistortedColor(float2 uv) { + + float2 coords = 2.0 * uv - 1.0; + float dst = dot(coords, coords); + float2 delta = coords * (dst * CHROMATIC_ABERRATION_INTENSITY); + float r = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv).r; + float g = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv - delta).g; + float b = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv - delta * 2.0).b; + return float4(r, g, b, 1.0); +} + +#else + +float4 GetDistortedColor(float2 uv) { + + float2 coords = 2.0 * uv - 1.0; + float dst = dot(coords, coords); + float2 delta = coords * (dst * CHROMATIC_ABERRATION_INTENSITY); + float4 abColor = float4(0,0,0,1.0); + +#if BEAUTIFY_CABERRATION_ALT + int samples = clamp( (int)(dst * CHROMATIC_ABERRATION_SMOOTHING) + 1, 1, CHROMATIC_ABERRATION_MAX_SAMPLES); + UNITY_UNROLL + for (int k=0;k_BokehData3.y) return 0; + float xd = abs(depth - _BokehData.x) - _BokehData2.x * (depth < _BokehData.x); + return min(_BokehData3.z, 0.5 * _BokehData.y * xd/depth); // radius of CoC + } + + float4 FragCoC (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float4 pixel = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv); + pixel = clamp(pixel, 0.0.xxxx, _BokehData3.xxxx); + #if UNITY_COLORSPACE_GAMMA + pixel.rgb = GAMMA_TO_LINEAR(pixel.rgb); + #endif + float coc = getCoc(i) / COC_BASE; + return float4(pixel.rgb, coc); + } + + float4 FragCoCDebug (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float4 pixel = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv); + float CoC = min(getCoc(i) / 16.0, 1.0); + return float4(CoC.xxx, 1.0); + } + + float4 FragDoFDebugTransparent (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float depthTex = BEAUTIFY_GET_CUSTOM_DEPTH_01(_DoFTransparentDepth, i.uv); + return float4(depthTex.xxx, 1.0); + } + + float4 FragBlur (VaryingsSimple i): SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float4 sum = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv ); + float samples = ceil(sum.a * COC_BASE); + + float4 dir = float4(_BokehData.zw * _MainTex_TexelSize.xy, 0, 0); + dir *= max(1.0, samples / _BokehData2.y); +#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) || defined(SINGLE_PASS_STEREO) + dir.x *= 2.0; +#endif + + float jitter = dot(float2(2.4084507, 3.2535211), i.uv * _MainTex_TexelSize.zw); + float2 disp0 = dir.xy * (frac(jitter) + 0.5); + float4 disp1 = float4(i.uv + disp0, 0, 0); + float4 disp2 = float4(i.uv - disp0, 0, 0); + float w = 1.0; + + const int sampleCount = (int)min(_BokehData2.y, samples); + UNITY_UNROLL + for (int k=1;k<16;k++) { + if (k 0) { + weightedSum /= weightSum; + } + c1.r = weightedSum; + c1.g = maxLum; + c1.b = weightSum * 0.25; + #endif + + return c1; + } + + float4 FragBlendScreenLum (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + float2 uv = UnityStereoTransformScreenSpaceTex(float2(0.5, 0.5)); + + float4 c = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv); + float4 p = SAMPLE_TEXTURE2D_X(_EAHist, sampler_LinearClamp, uv); + float speed = c.r < p.r ? _EyeAdaptation.z: _EyeAdaptation.w; + c.a = speed * unity_DeltaTime.x; + return c; + } + + float4 FragBlend (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float4 c = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, 0.5.xx); + c.a = 1.0; + return c; + } + +#endif \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSEA.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSEA.hlsl.meta new file mode 100644 index 00000000..e5c9f151 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSEA.hlsl.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 136698a3df19b478e98ecc73a7f68a1b +timeCreated: 1518001072 +licenseType: Pro +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSFilmGrain.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSFilmGrain.hlsl new file mode 100644 index 00000000..d3444b2c --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSFilmGrain.hlsl @@ -0,0 +1,106 @@ +#ifndef BEAUTIFY_PPS_FILM_GRAIN +#define BEAUTIFY_PPS_FILM_GRAIN + +float4 _FilmGrainData; // x: intensity, y: luma attenuation, z: resolution, w: unused +float4 _FilmArtifactsData; // x: dirt spots amount, y: dirt spots intensity, z: scratches amount, w: scratches intensity + +#define FILM_GRAIN_INTENSITY _FilmGrainData.x +#define FILM_GRAIN_LUMA_ATTENUATION _FilmGrainData.y +#define FILM_GRAIN_RESOLUTION _FilmGrainData.z + +#define DIRT_SPOTS_AMOUNT _FilmArtifactsData.x +#define DIRT_SPOTS_INTENSITY _FilmArtifactsData.y +#define SCRATCHES_AMOUNT _FilmArtifactsData.z +#define SCRATCHES_INTENSITY _FilmArtifactsData.w + +float3 r3(float2 uv) { + static const float2 magic1 = float2(321.8942, 1225.6548); + static const float magic2 = 4251.4865; + float d1 = dot(uv, magic1); + float d2 = dot(uv + 0.1, magic1); + float d3 = dot(uv + 0.2, magic1); + return frac(sin(float3(d1, d2, d3)) * magic2 + _Time.y); +} + +inline float r1(float x) { + static const float magic = 4251.4865; + return frac(sin(x * 321.8942) * magic + _Time.y); +} + + +// Generate film artifacts like dirt spots and scratches +float getFilmArtifacts(float2 uv) { + float artifacts = 0.0; + + // Dirt spots - small circular spots that appear randomly + UNITY_BRANCH + if (DIRT_SPOTS_AMOUNT > 0) { + float2 dirtUV = uv * 20.0; + float2 dirtCell = floor(dirtUV); + float2 dirtFrac = dirtUV - dirtCell; + float3 dirtRandom = r3(dirtCell + floor(_Time.y * 0.5)); + if (dirtRandom.x > DIRT_SPOTS_AMOUNT) { + float2 dirtOffset = dirtFrac - 0.5; + float dirtDistanceSqr = dot(dirtOffset, dirtOffset); + float dirtSize = dirtRandom.y * 0.3 + 0.1; + float dirtSpot = 1.0 - smoothstep(0.0, dirtSize * dirtSize, dirtDistanceSqr); + artifacts += dirtSpot * (dirtRandom.z - 0.5) * DIRT_SPOTS_INTENSITY; + } + } + + // Vertical scratches - appear occasionally and persist for a few frames + UNITY_BRANCH + if (SCRATCHES_AMOUNT > 0) { + float scratchTime = floor(dot(_Time.xyzw, 1.0)); + float scratchRandom = r1(scratchTime); + if (scratchRandom > SCRATCHES_AMOUNT) { + float scratchX = r1(scratchTime + 0.1); + float scratchWidth = 0.001 + r1(scratchTime + 0.2) * 0.003; + float scratchDistance = abs(uv.x - scratchX); + float scratch = 1.0 - smoothstep(0.0, scratchWidth, scratchDistance); + artifacts += scratch * SCRATCHES_INTENSITY; + } + } + + return artifacts; +} + +void ApplyFilmGrain(inout float3 rgb, float luma, float2 uv) { + + float2 noiseSize = _MainTex_TexelSize.zw * FILM_GRAIN_RESOLUTION; + float2 scaledUV = uv * noiseSize; + float2 cell = floor(scaledUV); + + #if BEAUTIFY_TURBO + static const float c0 = 1.0f; + static const float c1 = -1.828427f; + static const float c2 = 0.828427f; + float luminanceFactor = c0 + luma * (c1 + luma * c2); + float3 grain = r3(cell / noiseSize); + float artifacts = 0.0; + #else + float luminanceFactor = 1.0 - sqrt(luma); + // Bilinear interpolation + float2 fracUV = scaledUV - cell; + float2 invNoiseSize = rcp(noiseSize); + float3 rand00 = r3(cell * invNoiseSize); + float3 rand10 = r3((cell + float2(1, 0)) * invNoiseSize); + float3 rand01 = r3((cell + float2(0, 1)) * invNoiseSize); + float3 rand11 = r3((cell + float2(1, 1)) * invNoiseSize); + float3 randX0 = lerp(rand00, rand10, fracUV.x); + float3 randX1 = lerp(rand01, rand11, fracUV.x); + float3 grain = lerp(randX0, randX1, fracUV.y); + float artifacts = getFilmArtifacts(uv); + #endif + + static const float3 channelSensibility = float3(1, 0.95, 1.05); + grain = (grain - 0.5) * channelSensibility; + + float grainAmount = lerp(1.0, luminanceFactor, FILM_GRAIN_LUMA_ATTENUATION); + + rgb *= 1.0 + grain * grainAmount * FILM_GRAIN_INTENSITY + artifacts; + + rgb = saturate(rgb); +} + +#endif // BEAUTIFY_PPS_FILM_GRAIN \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSFilmGrain.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSFilmGrain.hlsl.meta new file mode 100644 index 00000000..7085f2ab --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSFilmGrain.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a2f62a5fa4eb746948cde9ffbfa3fa3f +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSLum.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSLum.hlsl new file mode 100644 index 00000000..8c25b44c --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSLum.hlsl @@ -0,0 +1,411 @@ +#ifndef BEAUTIFY_PPSLUM_FX +#define BEAUTIFY_PPSLUM_FX + + // Copyright 2020-2021 Kronnect - All Rights Reserved. + #include "BeautifyCommon.hlsl" + + TEXTURE2D_X(_MainTex); + TEXTURE2D_X(_BloomTex); + float4 _BloomTex_TexelSize; + TEXTURE2D_X(_CombineTex); + TEXTURE2D_X(_BloomTex1); + TEXTURE2D_X(_BloomTex2); + TEXTURE2D_X(_BloomTex3); + TEXTURE2D_X(_BloomTex4); + float4 _MainTex_TexelSize; + float4 _MainTex_ST; + float4 _Bloom; + float4 _BloomWeights; + float4 _BloomWeights2; + float4 _BloomTint; + float3 _BloomTint0, _BloomTint1, _BloomTint2, _BloomTint3, _BloomTint4, _BloomTint5; + float _BloomSpread; + float4 _AFTint; + float _BlurScale; + float4 _AFData; + + #if defined(USE_AF_THRESHOLD) + #define MAX_BRIGHTNESS _AFData.w + #else + #define MAX_BRIGHTNESS _BloomWeights2.z + + #endif + #if BEAUTIFY_BLOOM_USE_DEPTH || BEAUTIFY_ANAMORPHIC_FLARES_USE_DEPTH + float _BloomDepthThreshold; + float _BloomNearThreshold; + float _AFDepthThreshold; + float _AFNearThreshold; + #endif + + TEXTURE2D_X(_BloomSourceDepth); + TEXTURE2D_X(_AFSourceDepth); + + struct VaryingsCross { + float4 positionCS : SV_POSITION; + float2 uv: TEXCOORD0; + BEAUTIFY_VERTEX_CROSS_UV_DATA + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct VaryingsLum { + float4 positionCS : SV_POSITION; + float2 uv: TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct VaryingsCrossLum { + float4 positionCS : SV_POSITION; + float2 uv: TEXCOORD0; + BEAUTIFY_VERTEX_CROSS_UV_DATA + UNITY_VERTEX_OUTPUT_STEREO + }; + + + VaryingsLum VertLum(AttributesSimple input) { + + VaryingsLum output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + output.positionCS = input.positionOS; + output.positionCS.y *= _ProjectionParams.x * _FlipY; + output.uv = input.uv; + + return output; + } + + half Brightness(half3 c) { + return max(c.r, max(c.g, c.b)); + } + + half Included(half4 c) { + #if BEAUTIFY_BLOOM_USE_LAYER_INCLUSION || BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER_INCLUSION + return Brightness(c.rgb) >= 0.01; + #else + return Brightness(c.rgb) < 0.01; + #endif + } + + half3 ColorAboveThreshold(half3 c, half brightness) { + #if defined(USE_AF_THRESHOLD) + half threshold = _AFData.y; + #else + half threshold = _Bloom.w; + #endif + + #if BEAUTIFY_ANAMORPHIC_PROP_THRESHOLDING || BEAUTIFY_BLOOM_PROP_THRESHOLDING + half cs = clamp(brightness - 0.5 * threshold, 0.0, threshold); + cs = 0.5 * cs * cs / (threshold + 0.0001); + c *= max(brightness - threshold, cs) / max(brightness, 0.0001); + #else + c = max(c - threshold, 0); + #endif + + return c; + } + + half4 FragLum (VaryingsLum i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + half4 c = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv); + c = clamp(c, 0.0.xxxx, MAX_BRIGHTNESS.xxxx); + + #if UNITY_COLORSPACE_GAMMA + c.rgb = GAMMA_TO_LINEAR(c.rgb); + #endif + + #if BEAUTIFY_BLOOM_USE_DEPTH || BEAUTIFY_ANAMORPHIC_FLARES_USE_DEPTH + float depth01 = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv); + #endif + + #if BEAUTIFY_BLOOM_USE_DEPTH + c.rgb *= max(0, 1.0 - depth01 * _BloomDepthThreshold); + c.rgb *= min(1.0, depth01 / _BloomNearThreshold); + #endif + + #if BEAUTIFY_ANAMORPHIC_FLARES_USE_DEPTH + c.rgb *= max(0, 1.0 - depth01 * _AFDepthThreshold); + c.rgb *= min(1.0, depth01 / _AFNearThreshold); + #endif + + #if BEAUTIFY_BLOOM_USE_LAYER || BEAUTIFY_BLOOM_USE_LAYER_INCLUSION + half included = Included(SAMPLE_TEXTURE2D_X(_BloomSourceDepth, sampler_LinearClamp, i.uv)); + c.rgb *= included; + #endif + + #if BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER || BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER_INCLUSION + half included = Included(SAMPLE_TEXTURE2D_X(_AFSourceDepth, sampler_LinearClamp, i.uv)); + c.rgb *= included; + #endif + + c.a = Brightness(c.rgb); + #if !defined(USE_AF_THRESHOLD) + c.rgb = lerp(c.rgb, c.a * _BloomTint.rgb, _BloomTint.a); + #endif + c.rgb = ColorAboveThreshold(c.rgb, c.a); + return c; + } + + VaryingsCross VertCross(AttributesSimple v) { + VaryingsCross o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.positionCS = v.positionOS; + o.positionCS.y *= _ProjectionParams.x * _FlipY; + o.uv = v.uv; + BEAUTIFY_VERTEX_OUTPUT_CROSS_UV(o) + + return o; + } + + VaryingsCrossLum VertCrossLum(AttributesSimple v) { + VaryingsCrossLum o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.positionCS = v.positionOS; + o.positionCS.y *= _ProjectionParams.x * _FlipY; + o.uv = v.uv; + BEAUTIFY_VERTEX_OUTPUT_CROSS_UV(o) + + return o; + } + + half4 FragLumAntiflicker(VaryingsCrossLum i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + BEAUTIFY_FRAG_SETUP_CROSS_UV(i) + + half4 c1 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv1); + half4 c2 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv2); + half4 c3 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv3); + half4 c4 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv4); + + c1 = clamp(c1, 0.0.xxxx, MAX_BRIGHTNESS.xxxx); + c2 = clamp(c2, 0.0.xxxx, MAX_BRIGHTNESS.xxxx); + c3 = clamp(c3, 0.0.xxxx, MAX_BRIGHTNESS.xxxx); + c4 = clamp(c4, 0.0.xxxx, MAX_BRIGHTNESS.xxxx); + + #if BEAUTIFY_BLOOM_USE_DEPTH || BEAUTIFY_ANAMORPHIC_FLARES_USE_DEPTH + float depth01 = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv); + #endif + + #if BEAUTIFY_BLOOM_USE_DEPTH + float depthAtten = max(0, 1.0 - depth01 * _BloomDepthThreshold); + c1.rgb *= depthAtten; + c2.rgb *= depthAtten; + c3.rgb *= depthAtten; + c4.rgb *= depthAtten; + float nearAtten = min(1.0, depth01 / _BloomNearThreshold); + c1.rgb *= nearAtten; + c2.rgb *= nearAtten; + c3.rgb *= nearAtten; + c4.rgb *= nearAtten; + #endif + + #if BEAUTIFY_ANAMORPHIC_FLARES_USE_DEPTH + float depthAtten = max(0, 1.0 - depth01 * _AFDepthThreshold); + c1.rgb *= depthAtten; + c2.rgb *= depthAtten; + c3.rgb *= depthAtten; + c4.rgb *= depthAtten; + float nearAtten = min(1.0, depth01 / _AFNearThreshold); + c1.rgb *= nearAtten; + c2.rgb *= nearAtten; + c3.rgb *= nearAtten; + c4.rgb *= nearAtten; + #endif + + #if BEAUTIFY_BLOOM_USE_LAYER || BEAUTIFY_BLOOM_USE_LAYER_INCLUSION + half included = Included(SAMPLE_TEXTURE2D_X(_BloomSourceDepth, sampler_LinearClamp, i.uv)); + c1.rgb *= included; + c2.rgb *= included; + c3.rgb *= included; + c4.rgb *= included; + #endif + + #if BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER || BEAUTIFY_ANAMORPHIC_FLARES_USE_LAYER_INCLUSION + half included = Included(SAMPLE_TEXTURE2D_X(_AFSourceDepth, sampler_LinearClamp, i.uv)); + c1.rgb *= included; + c2.rgb *= included; + c3.rgb *= included; + c4.rgb *= included; + #endif + + c1.a = Brightness(c1.rgb); + c2.a = Brightness(c2.rgb); + c3.a = Brightness(c3.rgb); + c4.a = Brightness(c4.rgb); + + half w1 = 1.0 / (c1.a + 1.0); + half w2 = 1.0 / (c2.a + 1.0); + half w3 = 1.0 / (c3.a + 1.0); + half w4 = 1.0 / (c4.a + 1.0); + + half dd = 1.0 / (w1 + w2 + w3 + w4); + c1 = (c1 * w1 + c2 * w2 + c3 * w3 + c4 * w4) * dd; + + #if UNITY_COLORSPACE_GAMMA + c1.rgb = GAMMA_TO_LINEAR(c1.rgb); + #endif + + #if !defined(USE_AF_THRESHOLD) + c1.rgb = lerp(c1.rgb, c1.a * _BloomTint.rgb, _BloomTint.a); + #endif + c1.rgb = ColorAboveThreshold(c1.rgb, c1.a); + + return c1; + } + + float4 FragBloomCompose (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float4 b0 = SAMPLE_TEXTURE2D_X( _BloomTex , sampler_LinearClamp, i.uv ); + float4 b1 = SAMPLE_TEXTURE2D_X( _BloomTex1 , sampler_LinearClamp, i.uv ); + float4 b2 = SAMPLE_TEXTURE2D_X( _BloomTex2 , sampler_LinearClamp, i.uv ); + float4 b3 = SAMPLE_TEXTURE2D_X( _BloomTex3 , sampler_LinearClamp, i.uv ); + float4 b4 = SAMPLE_TEXTURE2D_X( _BloomTex4 , sampler_LinearClamp, i.uv ); + float4 b5 = SAMPLE_TEXTURE2D_X( _MainTex , sampler_LinearClamp, i.uv ); + b0.rgb *= _BloomTint0; + b1.rgb *= _BloomTint1; + b2.rgb *= _BloomTint2; + b3.rgb *= _BloomTint3; + b4.rgb *= _BloomTint4; + b5.rgb *= _BloomTint5; + float4 pixel = b0 * _BloomWeights.x + b1 * _BloomWeights.y + b2 * _BloomWeights.z + b3 * _BloomWeights.w + b4 * _BloomWeights2.x + b5 * _BloomWeights2.y; + //pixel.rgb = lerp(pixel.rgb, Brightness(pixel.rgb) * _BloomTint.rgb, _BloomTint.a); + return pixel; + } + + inline float4 Lerp3(float4 a, float4 b, float4 c, float t) { + if (t <= 0.5) { + return lerp(a, b, t * 2.0); + } else { + return lerp(b, c, t * 2.0 - 1.0); + } + } + + float4 FragResample(VaryingsCross i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + BEAUTIFY_FRAG_SETUP_CROSS_UV(i) + + float4 c1 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv1); + float4 c2 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv2); + float4 c3 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv3); + float4 c4 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv4); + + float w1 = 1.0 / (c1.a + 1.0); + float w2 = 1.0 / (c2.a + 1.0); + float w3 = 1.0 / (c3.a + 1.0); + float w4 = 1.0 / (c4.a + 1.0); + + float dd = 1.0 / (w1 + w2 + w3 + w4); + float4 v = (c1 * w1 + c2 * w2 + c3 * w3 + c4 * w4) * dd; + #if defined(COMBINE_BLOOM) + float4 o = SAMPLE_TEXTURE2D_X(_BloomTex, sampler_LinearClamp, i.uv); + v = Lerp3(o, o+v, v, _BloomSpread); + #endif + return v; + } + + float4 FragResampleAF(VaryingsCross i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + BEAUTIFY_FRAG_SETUP_CROSS_UV(i) + + float4 c1 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv1); + float4 c2 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv2); + float4 c3 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv3); + float4 c4 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv4); + + float w1 = 1.0 / (c1.a + 1.0); + float w2 = 1.0 / (c2.a + 1.0); + float w3 = 1.0 / (c3.a + 1.0); + float w4 = 1.0 / (c4.a + 1.0); + + float dd = 1.0 / (w1 + w2 + w3 + w4); + float4 v = (c1 * w1 + c2 * w2 + c3 * w3 + c4 * w4) * dd; + v.rgb = lerp(v.rgb, Brightness(c1.rgb) * _AFTint.rgb, _AFTint.a); + v.rgb *= _AFData.xxx; + + #if defined(COMBINE_BLOOM) + float4 o = SAMPLE_TEXTURE2D_X(_BloomTex, sampler_LinearClamp, i.uv); + v += o; + #endif + + return v; + } + + + float4 FragCombine(VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float4 c1 = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv); + float4 c2 = SAMPLE_TEXTURE2D_X(_CombineTex, sampler_LinearClamp, i.uv); + return c1 + c2; + } + + + float4 FragDebugBloom (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + return SAMPLE_TEXTURE2D_X(_BloomTex, sampler_LinearClamp, i.uv) * _Bloom.xxxx; + } + + + float4 FragDebugBloomExclusionLayer (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float depth = BEAUTIFY_GET_CUSTOM_DEPTH_01(_BloomSourceDepth, i.uv); + return float4(depth.xxx, 1.0); + } + + float4 FragDebugAnamorphicFlaresExclusionLayer (VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float depth = BEAUTIFY_GET_CUSTOM_DEPTH_01(_AFSourceDepth, i.uv); + return float4(depth.xxx, 1.0); + } + + float4 FragResampleFastAF(VaryingsSimple i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + float4 c = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv); + c.rgb = lerp(c.rgb, Brightness(c.rgb) * _AFTint.rgb, _AFTint.a); + c.rgb *= _AFData.xxx; + return c; + } + + VaryingsCross VertBlur(AttributesSimple v) { + VaryingsCross o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.positionCS = v.positionOS; + o.positionCS.y *= _ProjectionParams.x * _FlipY; + o.uv = v.uv; + BEAUTIFY_VERTEX_OUTPUT_GAUSSIAN_UV(o) + + return o; + } + + float4 FragBlur (VaryingsCross i): SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + BEAUTIFY_FRAG_SETUP_GAUSSIAN_UV(i) + + float4 pixel = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv) * 0.2270270270 + + (SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv1) + SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv2)) * 0.3162162162 + + (SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv3) + SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv4)) * 0.0702702703; + return pixel; + } + +#endif \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSLum.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSLum.hlsl.meta new file mode 100644 index 00000000..7ca7d8a5 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSLum.hlsl.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 5dc8cdd18d3c6470e91404ae4fab3163 +timeCreated: 1518001072 +licenseType: Pro +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSOutline.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSOutline.hlsl new file mode 100644 index 00000000..453c4de7 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSOutline.hlsl @@ -0,0 +1,205 @@ +#ifndef BEAUTIFY_PPSOUTLINE +#define BEAUTIFY_PPSOUTLINE + // Copyright 2016-2021 Ramiro Oliva (Kronnect) - All Rights Reserved. + + #include "BeautifyCommon.hlsl" + + TEXTURE2D_X(_MainTex); + float4 _MainTex_TexelSize; + float4 _MainTex_ST; + + TEXTURE2D_X_FLOAT(_OutlineDepth); + TEXTURE2D_X_FLOAT(_OutlineObjectId); + + float4 _Outline; + #define OUTLINE_EDGE_THRESHOLD _Outline.a + + float4 _OutlineData; + #define OUTLINE_INTENSITY_MULTIPLIER _OutlineData.x + #define OUTLINE_DISTANCE_FADE _OutlineData.y + #define OUTLINE_MIN_DEPTH_THRESHOLD _OutlineData.z + #define OUTLINE_MIN_SATURATION_THRESHOLD _OutlineData.w + + half _BlurScale; + #define OUTLINE_MIN_SEPARATION _OutlineData.z + + struct VaryingsOutline { + float4 positionCS : SV_POSITION; + float2 uv: TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct VaryingsCross { + float4 positionCS : SV_POSITION; + float2 uv: TEXCOORD0; + BEAUTIFY_VERTEX_CROSS_UV_DATA + UNITY_VERTEX_OUTPUT_STEREO + }; + + + VaryingsOutline VertOutline(AttributesSimple input) { + VaryingsOutline output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + output.positionCS = input.positionOS; + output.positionCS.y *= _ProjectionParams.x * _FlipY; + output.uv = input.uv; + return output; + } + + float OutlinePass(VaryingsOutline i) { + + float3 uvInc = float3(_MainTex_TexelSize.x, _MainTex_TexelSize.y, 0); + + #if BEAUTIFY_DEPTH_FADE || !BEAUTIFY_OUTLINE_SOBEL + #if BEAUTIFY_OUTLINE_CUSTOM_DEPTH || BEAUTIFY_OUTLINE_OBJECT_ID + float depth = BEAUTIFY_GET_CUSTOM_DEPTH_01(_OutlineDepth, i.uv); + float sceneDepth = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv); + if (sceneDepth < depth * 0.999) return 0; + #else + float depth = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv); + if (depth >= 1.0) return 0; + #endif + #endif + + float outline = 0; + + #if BEAUTIFY_OUTLINE_OBJECT_ID && !BEAUTIFY_OUTLINE_SOBEL + float objS = SAMPLE_TEXTURE2D_X(_OutlineObjectId, sampler_PointClamp, i.uv - uvInc.zy).x; + float objN = SAMPLE_TEXTURE2D_X(_OutlineObjectId, sampler_PointClamp, i.uv + uvInc.zy).x; + float objW = SAMPLE_TEXTURE2D_X(_OutlineObjectId, sampler_PointClamp, i.uv - uvInc.xz).x; + float objE = SAMPLE_TEXTURE2D_X(_OutlineObjectId, sampler_PointClamp, i.uv + uvInc.xz).x; + float maxObj = max( max(objS, objN), max(objW, objE) ); + float minObj = min( min(objS, objN), min(objW, objE) ); + float objDiff = maxObj - minObj; + outline = objDiff > 0.01; + + #if BEAUTIFY_OUTLINE_OUTER_ONLY + float depthN = BEAUTIFY_GET_CUSTOM_DEPTH_01(_OutlineDepth, i.uv + uvInc.zy); + float depthS = BEAUTIFY_GET_CUSTOM_DEPTH_01(_OutlineDepth, i.uv - uvInc.zy); + float depthW = BEAUTIFY_GET_CUSTOM_DEPTH_01(_OutlineDepth, i.uv - uvInc.xz); + float depthE = BEAUTIFY_GET_CUSTOM_DEPTH_01(_OutlineDepth, i.uv + uvInc.xz); + + float objM = SAMPLE_TEXTURE2D_X(_OutlineObjectId, sampler_PointClamp, i.uv).x; + if ( (depth < depthN && abs(objN - objM) > 0.01) || + (depth < depthS && abs(objS - objM) > 0.01) || + (depth < depthW && abs(objW - objM) > 0.01) || + (depth < depthE && abs(objE - objM) > 0.01)) + outline = 0; + #endif + + // check object is big enough + #if BEAUTIFY_OUTLINE_MIN_SEPARATION + uvInc *= OUTLINE_MIN_SEPARATION; + float objS2 = SAMPLE_TEXTURE2D_X(_OutlineObjectId, sampler_PointClamp, i.uv - uvInc.zy).x; + float objN2 = SAMPLE_TEXTURE2D_X(_OutlineObjectId, sampler_PointClamp, i.uv + uvInc.zy).x; + if (abs(objN2 - objN) > 0.01 && abs(objS2 - objS) > 0.01) outline *= 0.25 / OUTLINE_INTENSITY_MULTIPLIER; + float objW2 = SAMPLE_TEXTURE2D_X(_OutlineObjectId, sampler_PointClamp, i.uv - uvInc.xz).x; + float objE2 = SAMPLE_TEXTURE2D_X(_OutlineObjectId, sampler_PointClamp, i.uv + uvInc.xz).x; + if (abs(objE2 - objE) > 0.01 && abs(objW2 - objW) > 0.01) outline *= 0.25 / OUTLINE_INTENSITY_MULTIPLIER; + #endif + + #else + float3 rgbS = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv - uvInc.zy).rgb; + float3 rgbN = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv + uvInc.zy).rgb; + float3 rgbW = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv - uvInc.xz).rgb; + float3 rgbE = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv + uvInc.xz).rgb; + + #if BEAUTIFY_OUTLINE_CUSTOM_DEPTH || !BEAUTIFY_OUTLINE_SOBEL + #if BEAUTIFY_OUTLINE_CUSTOM_DEPTH + float depthS = BEAUTIFY_GET_CUSTOM_DEPTH_01(_OutlineDepth, i.uv - uvInc.zy); + float depthW = BEAUTIFY_GET_CUSTOM_DEPTH_01(_OutlineDepth, i.uv - uvInc.xz); + float depthE = BEAUTIFY_GET_CUSTOM_DEPTH_01(_OutlineDepth, i.uv + uvInc.xz); + float depthN = BEAUTIFY_GET_CUSTOM_DEPTH_01(_OutlineDepth, i.uv + uvInc.zy); + #else + float depthS = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv - uvInc.zy); + float depthW = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv - uvInc.xz); + float depthE = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv + uvInc.xz); + float depthN = BEAUTIFY_GET_SCENE_DEPTH_01(i.uv + uvInc.zy); + #endif + float maxDepth = max(depth, max(max(depthS, depthN), max(depthW, depthE))); + float minDepth = min(depth, min(min(depthS, depthN), min(depthW, depthE))); + float depthDiff = maxDepth - minDepth; + float3 normalNW = getNormal(depth, depthN, depthW, uvInc.zy, float2(-uvInc.x, -uvInc.z)); + float3 normalSE = getNormal(depth, depthS, depthE, -uvInc.zy, uvInc.xz); + float dnorm = dot(normalNW, normalSE); + float satN = getSaturation(rgbN); + float satS = getSaturation(rgbS); + float satW = getSaturation(rgbW); + float satE = getSaturation(rgbE); + float maxSat = max( max(satN, satS), max(satW, satE) ); + float minSat = min( min(satN, satS), min(satW, satE) ); + float dSat = maxSat - minSat; + outline = dSat > OUTLINE_MIN_SATURATION_THRESHOLD && dnorm < OUTLINE_EDGE_THRESHOLD && depthDiff > OUTLINE_MIN_DEPTH_THRESHOLD; + #else + float3 rgbSW = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv - uvInc.xy).rgb; + float3 rgbNE = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv + uvInc.xy).rgb; + float3 rgbSE = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv + float2( uvInc.x, -uvInc.y)).rgb; + float3 rgbNW = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv + float2(-uvInc.x, uvInc.y)).rgb; + float3 gx = rgbSW * -1.0; + gx += rgbSE * 1.0; + gx += rgbW * -2.0; + gx += rgbE * 2.0; + gx += rgbNW * -1.0; + gx += rgbNE * 1.0; + float3 gy = rgbSW * -1.0; + gy += rgbS * -2.0; + gy += rgbSE * -1.0; + gy += rgbNW * 1.0; + gy += rgbN * 2.0; + gy += rgbNE * 1.0; + outline = (length(gx * gx + gy * gy) - _Outline.a) > 0.0; + #endif + #endif + + #if BEAUTIFY_DEPTH_FADE + float factor = max(0, (OUTLINE_DISTANCE_FADE - depth) / OUTLINE_DISTANCE_FADE); + outline *= factor; + #endif + + return outline; + } + + float4 fragOutline (VaryingsOutline i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + float outline = OutlinePass(i); + return outline; + } + + + VaryingsCross VertBlur(AttributesSimple v) { + VaryingsCross o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.positionCS = v.positionOS; + o.positionCS.y *= _ProjectionParams.x * _FlipY; + o.uv = v.uv; + BEAUTIFY_VERTEX_OUTPUT_GAUSSIAN_UV(o) + + return o; + } + + half4 FragBlur (VaryingsCross i): SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + BEAUTIFY_FRAG_SETUP_GAUSSIAN_UV(i) + + half4 pixel = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv) * 0.2270270270 + + (SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv1) + SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv2)) * 0.3162162162 + + (SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv3) + SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv4)) * 0.0702702703; + return pixel; + } + + half4 FragCopy (VaryingsSimple i): SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + half outline = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, i.uv).r; + half4 color = half4(_Outline.rgb, _Outline.a * outline); + color *= OUTLINE_INTENSITY_MULTIPLIER; + color.a = saturate(color.a); + return color; + } + +#endif \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSOutline.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSOutline.hlsl.meta new file mode 100644 index 00000000..926e9f61 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSOutline.hlsl.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c704640fa1801475a870ff4fc5e06b86 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSSF.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSSF.hlsl new file mode 100644 index 00000000..f8cac6f7 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSSF.hlsl @@ -0,0 +1,196 @@ +#ifndef BEAUTIFY_PPSSF_FX +#define BEAUTIFY_PPSSF_FX + + // Copyright 2020-2021 Kronnect - All Rights Reserved. + #include "BeautifyCommon.hlsl" + + TEXTURE2D_X(_MainTex); + TEXTURE2D(_FlareTex); + TEXTURE2D(_OcclusionTex); + + float4 _MainTex_ST; + float4 _MainTex_TexelSize; + float4 _SunPos; + float3 _SunDir; + float4 _SunData; // x = sunIntensity, y = disk size, z = ray difraction, w = ray difraction amount + float4 _SunCoronaRays1; // x = length, y = streaks, z = spread, w = angle offset + float4 _SunCoronaRays2; // x = length, y = streaks, z = spread, w = angle offset + float4 _SunGhosts1; // x = reserved, y = size, 2 = pos offset, 3 = brightness + float4 _SunGhosts2; // x = reserved, y = size, 2 = pos offset, 3 = brightness + float4 _SunGhosts3; // x = reserved, y = size, 2 = pos offset, 3 = brightness + float4 _SunGhosts4; // x = reserved, y = size, 2 = pos offset, 3 = brightness + float3 _SunHalo; // x = offset, y = amplitude, z = intensity + float4 _SunTint; + float _SunFlaresAspectRatio; + float _SunOcclusionThreshold; + #define SUN_TINT_COLOR _SunTint.rgb + #define OCCLUSION_SPEED _SunTint.a + #define OCCLUSION_THRESHOLD _SunOcclusionThreshold + + struct VaryingsSF { + float4 positionCS : SV_POSITION; + float2 uv : TEXCOORD0; + float2 sunPos : TEXCOORD1; + UNITY_VERTEX_OUTPUT_STEREO + }; + + VaryingsSF VertSF(AttributesSimple input) { + VaryingsSF output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + output.positionCS = input.positionOS; + output.positionCS.y *= _ProjectionParams.x * _FlipY; + output.uv = input.uv.xy; + + float4 clipPos = TransformWorldToHClip(_WorldSpaceCameraPos.xyz - _SunDir.xyz * 1000.0); + float2 sunPos = float2(clipPos.x, clipPos.y * _ProjectionParams.x) * 0.5 / clipPos.w + 0.5; + output.sunPos = sunPos; + + return output; + } + + void rotate(inout float2 uv, float ang) { + float2 sico; + sincos(ang, sico.x, sico.y); + float2 cosi = float2(sico.y, -sico.x); + uv = float2(dot(cosi, uv), dot(sico, uv)); + } + + float3 sunflare(VaryingsSF input) { + + // general params + float2 uv = input.uv; + float2 sunPos = input.sunPos; + + #if BEAUTIFY_SF_OCCLUSION_SIMPLE + float depth = BEAUTIFY_GET_SCENE_DEPTH_01(sunPos); + if (depth < 1.0) return 0; + const float occlusion = 1.0; + #elif BEAUTIFY_SF_OCCLUSION_SMOOTH + float occlusion = SAMPLE_TEXTURE2D(_OcclusionTex, sampler_LinearRepeat, float2(0,0)).r; + if (occlusion <= 0.02) return 0.0.xxx; + #else + const float occlusion = 1.0; + #endif + + float2 grd = uv - sunPos; + float aspectRatio = _SunFlaresAspectRatio; + grd.y *= aspectRatio; + float len = length(grd); + + // sun disk + float s0 = pow( 1.0 + saturate(_SunData.y - len), 75) - 1.0; + + // corona rays + float gang = _SunPos.w; //atan2(0.5 - sunPos.y, sunPos.x - 0.5); + float ang = atan2(grd.y, grd.x) + gang; + float ray1 = _SunCoronaRays1.z + abs(_SunCoronaRays1.x * cos(_SunCoronaRays1.w + ang * _SunCoronaRays1.y)); // design + ray1 *= pow( 1.0 + len, 1.0/_SunCoronaRays1.x); + s0 += 1.0 / ray1; + + float ray2 = _SunCoronaRays2.z + abs(_SunCoronaRays2.x * sin(_SunCoronaRays2.w + ang * _SunCoronaRays2.y)); // design + ray2 *= pow( 1.0 + len, 1.0/_SunCoronaRays2.x); + s0 += 1.0 / ray2; + + s0 *= _SunData.x; + + float3 flare = s0.xxx; + + #if BEAUTIFY_SF_USE_GHOSTS // defined(UNITY_SINGLE_PASS_STEREO) && !defined(UNITY_STEREO_INSTANCING_ENABLED) && !defined(UNITY_STEREO_MULTIVIEW_ENABLED) + // ghosts circular (not compatible with XR due to how projection works) + + float2 ghost1Pos = 1.0 - sunPos; + grd = uv - ghost1Pos + (ghost1Pos - 0.5) * _SunGhosts1.z; + grd.y *= aspectRatio; + + float g0 = saturate(_SunGhosts1.y / length(grd)); + g0 = pow(g0, 12); + flare += g0 * _SunGhosts1.w / len; + + float2 ghost2Pos = 1.0 - sunPos; + grd = uv - ghost2Pos + (ghost2Pos - 0.5) * _SunGhosts2.z; + grd.y *= aspectRatio; + g0 = saturate(_SunGhosts2.y / length(grd)); + g0 = pow(g0, 12); + flare += g0 * _SunGhosts2.w / len; + + float2 ghost3Pos = 1.0 - sunPos; + grd = uv - ghost3Pos + (ghost3Pos - 0.5) * _SunGhosts3.z; + grd.y *= aspectRatio; + g0 = saturate(_SunGhosts3.y / length(grd)); + g0 = pow(g0, 12); + flare += g0 * _SunGhosts3.w / len; + + float2 ghost4Pos = 1.0 - sunPos; + grd = uv - ghost4Pos + (ghost4Pos - 0.5) * _SunGhosts4.z; + grd.y *= aspectRatio; + g0 = saturate(_SunGhosts4.y / length(grd)); + g0 = pow(g0, 12); + flare += g0 * _SunGhosts4.w / len; + + #endif + + // light rays + float2 uv2 = uv - sunPos; + float clen = length(uv2); + rotate(uv2, gang); + uv2.x *= aspectRatio; + uv2.x *= 0.1; + uv2 /= len; + float lr = saturate(SAMPLE_TEXTURE2D(_FlareTex, sampler_LinearRepeat, uv2 + _SunPos.zz).r - _SunData.w); + float3 rays = lr * sin(float3(len, len + 0.1, len + 0.2) * 3.1415927); + float atten = pow(1.0 + clen, 13.0); + rays *= _SunData.z / atten; + flare += rays; + + // halo + float hlen = clamp( (len - _SunHalo.x) * _SunHalo.y, 0, 3.1415927); + float3 halo = pow(sin(float3(hlen, hlen + 0.1, hlen + 0.2)), 12.0.xxx); + halo *= _SunHalo.z / atten; + flare += halo; + + return max(0, flare * SUN_TINT_COLOR * occlusion); + } + + float4 FragSF (VaryingsSF i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + //i.uv = UnityStereoTransformScreenSpaceTex(i.uv); + + return float4(sunflare(i), 1.0); + } + + float4 FragSFAdditive (VaryingsSF i) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + float2 stereoUV = UnityStereoTransformScreenSpaceTex(i.uv); + + float4 p = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, stereoUV); + return p + float4(sunflare(i), 1.0); + } + + float GetDepth(float2 sunPos, float2 offset) { + float2 pos = saturate(sunPos + offset * _MainTex_TexelSize.xy); + return BEAUTIFY_GET_SCENE_DEPTH_01(pos); + } + + float OcclusionTest(float2 sunPos) { + + float depth1 = GetDepth(sunPos, float2(-1, -1)); + float depth2 = GetDepth(sunPos, float2( 1, 1)); + float depth3 = GetDepth(sunPos, float2( 3, 3)); + float depth4 = GetDepth(sunPos, float2(-3, -3)); + float occlusion = (depth1 + depth2 + depth3 + depth4) * 0.25; + occlusion *= step(OCCLUSION_THRESHOLD, occlusion); + return occlusion; + } + + float4 FragSFOcclusion (VaryingsSF input) : SV_Target { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + float occlusion = OcclusionTest(input.sunPos); + #if BEAUTIFY_SF_OCCLUSION_INIT + return float4(occlusion, occlusion, occlusion, 1.0); + #else + return float4(occlusion, occlusion, occlusion, unity_DeltaTime.x * OCCLUSION_SPEED); + #endif + } + +#endif \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSSF.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSSF.hlsl.meta new file mode 100644 index 00000000..fee16985 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/BeautifyPPSSF.hlsl.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: d16ac644481a94c35a79383d0def48aa +timeCreated: 1518007506 +licenseType: Pro +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly.shader b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly.shader new file mode 100644 index 00000000..0450f92f --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly.shader @@ -0,0 +1,81 @@ +Shader "Hidden/Beautify2/DepthOnly" +{ + Properties + { + [MainTexture] _BaseMap ("Texture", 2D) = "white" {} + [MainColor] _BaseColor("Color", Color) = (1, 1, 1, 1) + _Cutoff("AlphaCutout", Range(0.0, 1.0)) = 0.5 + } + SubShader + { + ColorMask 0 + ZWrite On + Cull [_Cull] + + Pass + { + Name "Beautify DepthOnly Pass" + HLSLPROGRAM + #pragma target 4.5 + #pragma vertex UnlitPassVertex + #pragma fragment UnlitPassFragment + #pragma multi_compile_local _ DEPTH_PREPASS_ALPHA_TEST + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile_instancing + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + #if DEPTH_PREPASS_ALPHA_TEST + CBUFFER_START(UnityPerMaterial) + half _Cutoff; + float4 _BaseMap_ST; + CBUFFER_END + + #ifdef UNITY_DOTS_INSTANCING_ENABLED + UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) + UNITY_DOTS_INSTANCED_PROP(float, _Cutoff) + UNITY_DOTS_INSTANCED_PROP(float4, _BaseMap_ST) + UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata) + #define _Cutoff UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _Cutoff) + #define _BaseMap_ST UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _BaseMap_ST) + #endif + #endif + + #include "DepthOnly_Include.hlsl" + + ENDHLSL + } + + + Pass + { + Name "Beautify DepthOnly Pass" // for older GPUs with no DOTs instancing + HLSLPROGRAM + #pragma target 2.0 + #pragma vertex UnlitPassVertex + #pragma fragment UnlitPassFragment + #pragma multi_compile_local _ DEPTH_PREPASS_ALPHA_TEST + #pragma multi_compile_instancing + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + #if DEPTH_PREPASS_ALPHA_TEST + CBUFFER_START(UnityPerMaterial) + half _Cutoff; + float4 _BaseMap_ST; + CBUFFER_END + #endif + + #include "DepthOnly_Include.hlsl" + + ENDHLSL + } + + } +} diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly.shader.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly.shader.meta new file mode 100644 index 00000000..a87f22e7 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 13944f5ed1ab543b29d359ce4fedcb7c +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest.shader b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest.shader new file mode 100644 index 00000000..8ab01285 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest.shader @@ -0,0 +1,74 @@ +Shader "Hidden/Beautify2/DepthOnlyAlphaTest" +{ + Properties + { + [MainTexture] _BaseMap ("Texture", 2D) = "white" {} + [MainColor] _BaseColor("Color", Color) = (1, 1, 1, 1) + _Cutoff("AlphaCutout", Range(0.0, 1.0)) = 0.5 + } + SubShader + { + ColorMask 0 + ZWrite On + Cull Back + + Pass + { + Name "Beautify DepthOnly Alpha Test Pass" + HLSLPROGRAM + #pragma target 4.5 + #pragma vertex UnlitPassVertex + #pragma fragment UnlitPassFragment + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile_instancing + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + half _OutlineCutOff; + + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + CBUFFER_END + + #ifdef UNITY_DOTS_INSTANCING_ENABLED + UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) + UNITY_DOTS_INSTANCED_PROP(float4, _BaseMap_ST) + UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata) + #define _BaseMap_ST UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _BaseMap_ST) + #endif + + #include "DepthOnlyAlphaTest_Include.hlsl" + + ENDHLSL + } + + + Pass + { + Name "Beautify DepthOnly Alpha Test Pass" // for older GPUs with no DOTs instancing + HLSLPROGRAM + #pragma target 2.0 + #pragma vertex UnlitPassVertex + #pragma fragment UnlitPassFragment + #pragma multi_compile_instancing + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + half _OutlineCutOff; + + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + CBUFFER_END + + #include "DepthOnlyAlphaTest_Include.hlsl" + + ENDHLSL + } + } +} diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest.shader.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest.shader.meta new file mode 100644 index 00000000..17db9a15 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: d04252e5ea700488f9d1adcccbda3af3 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest_Include.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest_Include.hlsl new file mode 100644 index 00000000..d368dcee --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest_Include.hlsl @@ -0,0 +1,45 @@ +struct Attributes +{ + float4 positionOS : POSITION; + float2 uv : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct Varyings +{ + float4 positionCS : SV_POSITION; + float2 uv : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +Varyings UnlitPassVertex(Attributes input) +{ + Varyings output = (Varyings)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz); + + output.positionCS = vertexInput.positionCS; + output.uv = TRANSFORM_TEX(input.uv, _BaseMap); + + return output; +} + +void UnlitPassFragment( + Varyings input + , out half4 outColor : SV_Target0 +) +{ + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + half4 color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv); + clip(color.a - _OutlineCutOff); + + outColor = 0; + +} diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest_Include.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest_Include.hlsl.meta new file mode 100644 index 00000000..bce26fe1 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyAlphaTest_Include.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 727d7e57de2fc475b9665ec321327224 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId.shader b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId.shader new file mode 100644 index 00000000..38bbcc78 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId.shader @@ -0,0 +1,79 @@ +Shader "Hidden/Beautify2/DepthOnlyWithObjectId" +{ + Properties + { + [MainTexture] _BaseMap ("Texture", 2D) = "white" {} + [MainColor] _BaseColor("Color", Color) = (1, 1, 1, 1) + _Cutoff("AlphaCutout", Range(0.0, 1.0)) = 0.5 + } + SubShader + { + ZWrite On + Cull [_Cull] + + Pass + { + Name "Beautify DepthOnly With ObjectId Pass" + HLSLPROGRAM + #pragma target 4.5 + #pragma vertex UnlitPassVertex + #pragma fragment UnlitPassFragment + #pragma multi_compile_local _ DEPTH_PREPASS_ALPHA_TEST + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile_instancing + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + #if DEPTH_PREPASS_ALPHA_TEST + CBUFFER_START(UnityPerMaterial) + half _Cutoff; + float4 _BaseMap_ST; + CBUFFER_END + + #ifdef UNITY_DOTS_INSTANCING_ENABLED + UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) + UNITY_DOTS_INSTANCED_PROP(float, _Cutoff) + UNITY_DOTS_INSTANCED_PROP(float4, _BaseMap_ST) + UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata) + #define _Cutoff UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _Cutoff) + #define _BaseMap_ST UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _BaseMap_ST) + #endif + + #endif + + #include "DepthOnlyWithObjectId_Include.hlsl" + + ENDHLSL + } + + Pass + { + Name "Beautify DepthOnly With ObjectId Pass" + HLSLPROGRAM + #pragma target 2.0 + #pragma vertex UnlitPassVertex + #pragma fragment UnlitPassFragment + #pragma multi_compile_local _ DEPTH_PREPASS_ALPHA_TEST + #pragma multi_compile_instancing + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + #if DEPTH_PREPASS_ALPHA_TEST + CBUFFER_START(UnityPerMaterial) + half _Cutoff; + float4 _BaseMap_ST; + CBUFFER_END + #endif + + #include "DepthOnlyWithObjectId_Include.hlsl" + + ENDHLSL + } + } +} diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId.shader.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId.shader.meta new file mode 100644 index 00000000..bb9d605b --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 9d0c093c7389d4312af43ddc63c2fa3f +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest.shader b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest.shader new file mode 100644 index 00000000..5ef51bfb --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest.shader @@ -0,0 +1,71 @@ +Shader "Hidden/Beautify2/DepthOnlyWithObjectIdAlphaTest" +{ + Properties + { + [MainTexture] _BaseMap ("Texture", 2D) = "white" {} + [MainColor] _BaseColor("Color", Color) = (1, 1, 1, 1) + } + SubShader + { + ZWrite On + Cull Back + + Pass + { + Name "Beautify DepthOnly With ObjectId Alpha Test Pass" + HLSLPROGRAM + #pragma target 4.5 + #pragma vertex UnlitPassVertex + #pragma fragment UnlitPassFragment + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile_instancing + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + half _OutlineCutOff; + + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + CBUFFER_END + + #ifdef UNITY_DOTS_INSTANCING_ENABLED + UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) + UNITY_DOTS_INSTANCED_PROP(float4, _BaseMap_ST) + UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata) + #define _BaseMap_ST UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _BaseMap_ST) + #endif + + #include "DepthOnlyWithObjectIdAlphaTest_Include.hlsl" + + ENDHLSL + } + + Pass + { + Name "Beautify DepthOnly With ObjectId Alpha Test Pass" // for older GPUs with no DOTs instancing + HLSLPROGRAM + #pragma target 2.0 + #pragma vertex UnlitPassVertex + #pragma fragment UnlitPassFragment + #pragma multi_compile_instancing + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + half _OutlineCutOff; + + TEXTURE2D(_BaseMap); + SAMPLER(sampler_BaseMap); + + CBUFFER_START(UnityPerMaterial) + float4 _BaseMap_ST; + CBUFFER_END + + #include "DepthOnlyWithObjectIdAlphaTest_Include.hlsl" + + ENDHLSL + } + } +} diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest.shader.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest.shader.meta new file mode 100644 index 00000000..18a52c85 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1801c4e234eee4d99a8226b9cab3c01b +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest_Include.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest_Include.hlsl new file mode 100644 index 00000000..858d9a5a --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest_Include.hlsl @@ -0,0 +1,53 @@ + +struct Attributes +{ + float4 positionOS : POSITION; + float2 uv : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct Varyings +{ + float4 positionCS : SV_POSITION; + float2 uv : TEXCOORD0; + float objectId : TEXCOORD1; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +Varyings UnlitPassVertex(Attributes input) +{ + Varyings output = (Varyings)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz); + + output.positionCS = vertexInput.positionCS; + output.uv = TRANSFORM_TEX(input.uv, _BaseMap); + + VertexPositionInputs vertexInput0 = GetVertexPositionInputs(float3(1,1,1)); + + float3 posWS0 = TransformObjectToWorld(float3(0,0,0)); + float objectId = dot(vertexInput0.positionWS, 1); + output.objectId = objectId; + + return output; +} + +void UnlitPassFragment( + Varyings input + , out half4 outColor : SV_Target0 +) +{ + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + half4 color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv); + clip(color.a - _OutlineCutOff); + + outColor = input.objectId; +} diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest_Include.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest_Include.hlsl.meta new file mode 100644 index 00000000..0f6e1f03 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectIdAlphaTest_Include.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 437cd803475ec42389edc2d7ba7b85e1 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId_Include.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId_Include.hlsl new file mode 100644 index 00000000..31115d87 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId_Include.hlsl @@ -0,0 +1,61 @@ + +struct Attributes +{ + float4 positionOS : POSITION; + #if DEPTH_PREPASS_ALPHA_TEST + float2 uv : TEXCOORD0; + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct Varyings +{ + float4 positionCS : SV_POSITION; + + #if DEPTH_PREPASS_ALPHA_TEST + float2 uv : TEXCOORD0; + #endif + + float objectId : TEXCOORD1; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +Varyings UnlitPassVertex(Attributes input) +{ + Varyings output = (Varyings)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz); + + output.positionCS = vertexInput.positionCS; + #if DEPTH_PREPASS_ALPHA_TEST + output.uv = TRANSFORM_TEX(input.uv, _BaseMap); + #endif + + VertexPositionInputs vertexInput0 = GetVertexPositionInputs(float3(1,1,1)); + float objectId = dot(vertexInput0.positionWS, 1); + output.objectId = objectId; + + return output; +} + +void UnlitPassFragment( + Varyings input + , out half4 outColor : SV_Target0 +) +{ + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + #if DEPTH_PREPASS_ALPHA_TEST + half4 color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv); + clip(color.a - _Cutoff); + #endif + + outColor = input.objectId; +} diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId_Include.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId_Include.hlsl.meta new file mode 100644 index 00000000..2f285311 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnlyWithObjectId_Include.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 348330f64a84643f889321b73f3bb033 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly_Include.hlsl b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly_Include.hlsl new file mode 100644 index 00000000..53bb55db --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly_Include.hlsl @@ -0,0 +1,58 @@ + +struct Attributes +{ + float4 positionOS : POSITION; + #if DEPTH_PREPASS_ALPHA_TEST + float2 uv : TEXCOORD0; + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct Varyings +{ + float4 positionCS : SV_POSITION; + + #if DEPTH_PREPASS_ALPHA_TEST + float2 uv : TEXCOORD0; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +Varyings UnlitPassVertex(Attributes input) +{ + Varyings output = (Varyings)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz); + + output.positionCS = vertexInput.positionCS; + #if DEPTH_PREPASS_ALPHA_TEST + output.uv = TRANSFORM_TEX(input.uv, _BaseMap); + #endif + + return output; +} + +void UnlitPassFragment( + Varyings input + , out half4 outColor : SV_Target0 +) +{ + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + #if DEPTH_PREPASS_ALPHA_TEST + half4 color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv); + clip(color.a - _Cutoff); + #endif + + outColor = 0; + +} + + \ No newline at end of file diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly_Include.hlsl.meta b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly_Include.hlsl.meta new file mode 100644 index 00000000..22545d60 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Shaders/DepthOnly_Include.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 92428f66f0cce4f1e8d7d818ace6bd0a +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Textures.meta b/Assets/External/Beautify/URP/Runtime/Resources/Textures.meta new file mode 100644 index 00000000..9833c9e6 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 104bea161954b4873b346db4701a45a2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Textures/blueNoise.png b/Assets/External/Beautify/URP/Runtime/Resources/Textures/blueNoise.png new file mode 100644 index 00000000..79067588 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Textures/blueNoise.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efc2ec76689cc5c879cfed35c541120f30039eacc799a37edb5e419355e0bc60 +size 4196 diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Textures/blueNoise.png.meta b/Assets/External/Beautify/URP/Runtime/Resources/Textures/blueNoise.png.meta new file mode 100644 index 00000000..cf421cef --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Textures/blueNoise.png.meta @@ -0,0 +1,147 @@ +fileFormatVersion: 2 +guid: e6a467a4c71a24898ac842ed6f9a1d52 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + cookieLightType: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Textures/flareNoise.png b/Assets/External/Beautify/URP/Runtime/Resources/Textures/flareNoise.png new file mode 100644 index 00000000..f327c4da --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Textures/flareNoise.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60e8071f02eccf80da3dc0a44c303d7e0bb567bdadd388190f276265bc7f4aa3 +size 47083 diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Textures/flareNoise.png.meta b/Assets/External/Beautify/URP/Runtime/Resources/Textures/flareNoise.png.meta new file mode 100644 index 00000000..42d72927 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Textures/flareNoise.png.meta @@ -0,0 +1,59 @@ +fileFormatVersion: 2 +guid: 93092410bbc6f4ccba773578db5832d9 +timeCreated: 1488661131 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Textures/lensDirt.png b/Assets/External/Beautify/URP/Runtime/Resources/Textures/lensDirt.png new file mode 100644 index 00000000..f56cce02 --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Textures/lensDirt.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63fb35c8c904efd605a748c842ff9d9016329fc7e7710257ae292dcbc9b5693c +size 473839 diff --git a/Assets/External/Beautify/URP/Runtime/Resources/Textures/lensDirt.png.meta b/Assets/External/Beautify/URP/Runtime/Resources/Textures/lensDirt.png.meta new file mode 100644 index 00000000..af5ddb3d --- /dev/null +++ b/Assets/External/Beautify/URP/Runtime/Resources/Textures/lensDirt.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 0bd567658bec947d2b4d2877ccb0faa7 +timeCreated: 1532083478 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + 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} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: