From 7de81cc1ec02ecb9e9627a69ba4ff7ecf5a31e15 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 2 Jan 2025 20:32:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BB=A4=E9=95=9C=E7=A7=BB=E6=A4=8D=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Scene/TestFilter.unity | 467 ------------------ .../Assets/Script/AppMain/Initer.cs | 1 + ...troArch_Glow.meta => Crtglow-Lanczos.meta} | 2 +- .../Filter/Crtglow-Lanczos/Crtglow_Lanczos.cs | 57 +++ .../Crtglow-Lanczos/Crtglow_Lanczos.cs.meta | 2 + .../Crtglow-Lanczos/Lanczos_horiz.shader | 71 +++ .../Lanczos_horiz.shader.meta} | 2 +- .../Filter/Crtglow-Lanczos/Linearize.shader | 41 ++ .../Linearize.shader.meta} | 2 +- .../Filter/Crtglow-Lanczos/blur_horiz.shader | 49 ++ .../Crtglow-Lanczos/blur_horiz.shader.meta | 9 + .../Filter/Crtglow-Lanczos/blur_vert.shader | 49 ++ .../Crtglow-Lanczos/blur_vert.shader.meta | 9 + .../Filter/Crtglow-Lanczos/gauss_vert.shader | 90 ++++ .../Crtglow-Lanczos/gauss_vert.shader.meta | 9 + .../Filter/Crtglow-Lanczos/resolve.shader | 205 ++++++++ .../Crtglow-Lanczos/resolve.shader.meta | 9 + .../Filter/Crtglow-Lanczos/threshold.shader | 42 ++ .../Crtglow-Lanczos/threshold.shader.meta | 9 + .../AppSettings/Filter/FilterChain.cginc | 17 + ...rams.cginc.meta => FilterChain.cginc.meta} | 2 +- .../AppSettings/Filter/FilterChainEffect.cs | 85 +++- .../AppSettings/Filter/FilterEffect.cs | 2 +- .../AppSettings/Filter/FilterManager.cs | 1 - .../RetroArch_Glow/RetroArchMattiasCRTGlow.cs | 69 --- .../RetroArchMattiasCRTGlow.cs.meta | 2 - .../Filter/RetroArch_Glow/RetroArch_Glow.mat | 41 -- .../RetroArch_Glow/RetroArch_Glow.mat.meta | 8 - .../RetroArch_Glow/RetroArch_Glow.shader | 394 --------------- .../Filter/RetroArch_Glow/blur_params.cginc | 4 - ...plate.shader => ShaderTEMPLATE.shader.bak} | 11 +- .../Filter/ShaderTEMPLATE.shader.bak.meta} | 2 +- .../Assets/Script/TestFilter.cs | 50 -- .../Assets/Script/TestFilter.cs.meta | 2 - .../ProjectSettings/GraphicsSettings.asset | 5 +- 35 files changed, 744 insertions(+), 1076 deletions(-) delete mode 100644 AxibugEmuOnline.Client/Assets/Scene/TestFilter.unity rename AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/{RetroArch_Glow.meta => Crtglow-Lanczos.meta} (77%) create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Crtglow_Lanczos.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Crtglow_Lanczos.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Lanczos_horiz.shader rename AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/{RetroArch_Glow/RetroArch_Glow.shader.meta => Crtglow-Lanczos/Lanczos_horiz.shader.meta} (80%) create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Linearize.shader rename AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/{FilterShaderTemplate.shader.meta => Crtglow-Lanczos/Linearize.shader.meta} (80%) create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_horiz.shader create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_horiz.shader.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_vert.shader create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_vert.shader.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/gauss_vert.shader create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/gauss_vert.shader.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/resolve.shader create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/resolve.shader.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/threshold.shader create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/threshold.shader.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChain.cginc rename AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/{RetroArch_Glow/blur_params.cginc.meta => FilterChain.cginc.meta} (75%) delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArchMattiasCRTGlow.cs delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArchMattiasCRTGlow.cs.meta delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.mat delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.mat.meta delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.shader delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/blur_params.cginc rename AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/{FilterShaderTemplate.shader => ShaderTEMPLATE.shader.bak} (69%) rename AxibugEmuOnline.Client/Assets/{Scene/TestFilter.unity.meta => Script/AppMain/Manager/AppSettings/Filter/ShaderTEMPLATE.shader.bak.meta} (74%) delete mode 100644 AxibugEmuOnline.Client/Assets/Script/TestFilter.cs delete mode 100644 AxibugEmuOnline.Client/Assets/Script/TestFilter.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Scene/TestFilter.unity b/AxibugEmuOnline.Client/Assets/Scene/TestFilter.unity deleted file mode 100644 index 9b00b74f..00000000 --- a/AxibugEmuOnline.Client/Assets/Scene/TestFilter.unity +++ /dev/null @@ -1,467 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!29 &1 -OcclusionCullingSettings: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_OcclusionBakeSettings: - smallestOccluder: 5 - smallestHole: 0.25 - backfaceThreshold: 100 - m_SceneGUID: 00000000000000000000000000000000 - m_OcclusionCullingData: {fileID: 0} ---- !u!104 &2 -RenderSettings: - m_ObjectHideFlags: 0 - serializedVersion: 10 - m_Fog: 0 - m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - m_FogMode: 3 - m_FogDensity: 0.01 - m_LinearFogStart: 0 - m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} - m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} - m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 1 - m_AmbientMode: 0 - m_SubtractiveShadowColor: {r: 0.4292453, g: 0.5907795, b: 1, a: 1} - m_SkyboxMaterial: {fileID: 0} - m_HaloStrength: 0.5 - m_FlareStrength: 1 - m_FlareFadeSpeed: 3 - m_HaloTexture: {fileID: 0} - m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} - m_DefaultReflectionMode: 0 - m_DefaultReflectionResolution: 128 - m_ReflectionBounces: 1 - m_ReflectionIntensity: 1 - m_CustomReflection: {fileID: 0} - m_Sun: {fileID: 0} - m_UseRadianceAmbientProbe: 0 ---- !u!157 &3 -LightmapSettings: - m_ObjectHideFlags: 0 - serializedVersion: 13 - m_BakeOnSceneLoad: 0 - m_GISettings: - serializedVersion: 2 - m_BounceScale: 1 - m_IndirectOutputScale: 1 - m_AlbedoBoost: 1 - m_EnvironmentLightingMode: 0 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 0 - m_LightmapEditorSettings: - serializedVersion: 12 - m_Resolution: 2 - m_BakeResolution: 40 - m_AtlasSize: 1024 - m_AO: 0 - m_AOMaxDistance: 1 - m_CompAOExponent: 1 - m_CompAOExponentDirect: 0 - m_ExtractAmbientOcclusion: 0 - m_Padding: 2 - m_LightmapParameters: {fileID: 0} - m_LightmapsBakeMode: 1 - m_TextureCompression: 1 - m_ReflectionCompression: 2 - m_MixedBakeMode: 2 - m_BakeBackend: 1 - m_PVRSampling: 1 - m_PVRDirectSampleCount: 32 - m_PVRSampleCount: 512 - m_PVRBounces: 2 - m_PVREnvironmentSampleCount: 256 - m_PVREnvironmentReferencePointCount: 2048 - m_PVRFilteringMode: 1 - m_PVRDenoiserTypeDirect: 1 - m_PVRDenoiserTypeIndirect: 1 - m_PVRDenoiserTypeAO: 1 - m_PVRFilterTypeDirect: 0 - m_PVRFilterTypeIndirect: 0 - m_PVRFilterTypeAO: 0 - m_PVREnvironmentMIS: 1 - m_PVRCulling: 1 - m_PVRFilteringGaussRadiusDirect: 1 - m_PVRFilteringGaussRadiusIndirect: 1 - m_PVRFilteringGaussRadiusAO: 1 - m_PVRFilteringAtrousPositionSigmaDirect: 0.5 - m_PVRFilteringAtrousPositionSigmaIndirect: 2 - m_PVRFilteringAtrousPositionSigmaAO: 1 - m_ExportTrainingData: 0 - m_TrainingDataDestination: TrainingData - m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} - m_LightingSettings: {fileID: 0} ---- !u!196 &4 -NavMeshSettings: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_BuildSettings: - serializedVersion: 3 - agentTypeID: 0 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.4 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - minRegionArea: 2 - manualCellSize: 0 - cellSize: 0.16666667 - manualTileSize: 0 - tileSize: 256 - buildHeightMesh: 0 - maxJobWorkers: 0 - preserveTilesOutsideBounds: 0 - debug: - m_Flags: 0 - m_NavMeshData: {fileID: 0} ---- !u!1 &33805169 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 33805170} - - component: {fileID: 33805172} - - component: {fileID: 33805171} - m_Layer: 5 - m_Name: Image (1) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &33805170 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 33805169} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1319295996} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &33805171 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 33805169} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: e043954733c440645ba43b09301ee4a6, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!222 &33805172 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 33805169} - m_CullTransparentMesh: 1 ---- !u!1 &141076932 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 141076935} - - component: {fileID: 141076934} - - component: {fileID: 141076933} - m_Layer: 0 - m_Name: Camera - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!81 &141076933 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 141076932} - m_Enabled: 1 ---- !u!20 &141076934 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 141076932} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_Iso: 200 - m_ShutterSpeed: 0.005 - m_Aperture: 16 - m_FocusDistance: 10 - m_FocalLength: 50 - m_BladeCount: 5 - m_Curvature: {x: 2, y: 11} - m_BarrelClipping: 0.25 - m_Anamorphism: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!4 &141076935 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 141076932} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -5.3346887, y: -4.3005414, z: 3715.6099} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1319295992 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1319295996} - - component: {fileID: 1319295995} - - component: {fileID: 1319295994} - m_Layer: 5 - m_Name: Canvas - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1319295994 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1319295992} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} - m_Name: - m_EditorClassIdentifier: - m_UiScaleMode: 0 - m_ReferencePixelsPerUnit: 100 - m_ScaleFactor: 1 - m_ReferenceResolution: {x: 800, y: 600} - m_ScreenMatchMode: 0 - m_MatchWidthOrHeight: 0 - m_PhysicalUnit: 3 - m_FallbackScreenDPI: 96 - m_DefaultSpriteDPI: 96 - m_DynamicPixelsPerUnit: 1 - m_PresetInfoIsWorld: 0 ---- !u!223 &1319295995 -Canvas: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1319295992} - m_Enabled: 1 - serializedVersion: 3 - m_RenderMode: 1 - m_Camera: {fileID: 141076934} - m_PlaneDistance: 100 - m_PixelPerfect: 0 - m_ReceivesEvents: 1 - m_OverrideSorting: 0 - m_OverridePixelPerfect: 0 - m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 - m_AdditionalShaderChannelsFlag: 1 - m_UpdateRectTransformForStandalone: 0 - m_SortingLayerID: 0 - m_SortingOrder: 0 - m_TargetDisplay: 0 ---- !u!224 &1319295996 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1319295992} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0, y: 0, z: 0} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 33805170} - - {fileID: 1376779137} - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0, y: 0} ---- !u!1 &1376779136 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1376779137} - - component: {fileID: 1376779139} - - component: {fileID: 1376779140} - - component: {fileID: 1376779141} - m_Layer: 5 - m_Name: filter - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1376779137 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1376779136} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1319295996} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &1376779139 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1376779136} - m_CullTransparentMesh: 1 ---- !u!114 &1376779140 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1376779136} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 40d1396d19f4da44f98dd2fcf6f0bc56, type: 3} - m_Name: - m_EditorClassIdentifier: - filterMat: {fileID: 2100000, guid: 5965751351debd6499aa27660a1bc92e, type: 2} - img: {fileID: 1376779141} - source: {fileID: 2800000, guid: e043954733c440645ba43b09301ee4a6, type: 3} ---- !u!114 &1376779141 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1376779136} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Texture: {fileID: 0} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!1660057539 &9223372036854775807 -SceneRoots: - m_ObjectHideFlags: 0 - m_Roots: - - {fileID: 141076935} - - {fileID: 1319295996} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs index 1a03268c..16b23d22 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs @@ -14,6 +14,7 @@ namespace AxibugEmuOnline.Client [SerializeField] GameObject IMPORTENT; + #if UNITY_EDITOR public bool bTest = false; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos.meta similarity index 77% rename from AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow.meta rename to AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos.meta index beac7d49..1481f299 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow.meta +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 59751f7f4dc560f47b438056fbc26701 +guid: ace07ab80f4936646b7e77f33057ebe3 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Crtglow_Lanczos.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Crtglow_Lanczos.cs new file mode 100644 index 00000000..99c708a2 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Crtglow_Lanczos.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using UnityEngine; + +[Strip(RuntimePlatform.PSP2)] +public class Crtglow_Lanczos : FilterChainEffect +{ + protected override void DefinePasses(ref List passes) + { + passes.Add(PassDefine.Create( + "Filter/RetroArch/Glow/Linearize", + sRGB: true + )); + passes.Add(PassDefine.Create( + "Filter/RetroArch/Glow/Lanczos_horiz", + scaleModeX: EnumScaleMode.Viewport, + scaleModeY: EnumScaleMode.Source, + scaleX: 1f, scaleY: 1f, + sRGB: true + )); + passes.Add(PassDefine.Create( + "Filter/RetroArch/Glow/Gauss_vert", + scaleModeX: EnumScaleMode.Viewport, scaleModeY: EnumScaleMode.Viewport, + scaleX: 1f, scaleY: 1f, + sRGB: true, + outputAlias: "CRTPass" + )); + passes.Add(PassDefine.Create( + "Filter/RetroArch/Glow/threshold", + sRGB: true + )); + passes.Add(PassDefine.Create( + "Filter/RetroArch/Glow/blur_horiz", + filterMode: FilterMode.Bilinear, + scaleModeX: EnumScaleMode.Source, scaleModeY: EnumScaleMode.Source, + scaleX: 0.25f, scaleY: 0.25f, + sRGB: true + )); + passes.Add(PassDefine.Create( + "Filter/RetroArch/Glow/blur_vert", + filterMode: FilterMode.Bilinear, + sRGB: true + )); + passes.Add(PassDefine.Create( + "Filter/RetroArch/Glow/blur_vert", + filterMode: FilterMode.Bilinear, + sRGB: true + )); + passes.Add(PassDefine.Create( + "Filter/RetroArch/Glow/blur_vert", + filterMode: FilterMode.Bilinear, + scaleModeX: EnumScaleMode.Viewport, scaleModeY: EnumScaleMode.Viewport + )); + + } + + public override string Name => "Crtglow-lanczos"; +} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Crtglow_Lanczos.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Crtglow_Lanczos.cs.meta new file mode 100644 index 00000000..d3c10c0c --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Crtglow_Lanczos.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cd61170a32c41f64293333eec3eb28af \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Lanczos_horiz.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Lanczos_horiz.shader new file mode 100644 index 00000000..ea0468d5 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Lanczos_horiz.shader @@ -0,0 +1,71 @@ +Shader "Filter/RetroArch/Glow/Lanczos_horiz" +{ + Properties + { + + } + SubShader + { + Pass + { + CGPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + #include "../FilterChain.cginc" + + struct v2f + { + float4 pos : POSITION; + float2 uv : TEXCOORD0; + float2 pixNoAndDataOne : COLOR; + }; + + v2f vert( appdata_img v ) + { + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f, o); + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.pos = UnityObjectToClipPos (v.vertex); + o.uv = v.texcoord; + + o.pixNoAndDataOne.x = o.uv.x * SourceSize.x; + o.pixNoAndDataOne.y = SourceSize.z; + + return o; + } + + fixed4 frag (v2f IN) : SV_Target + { + float data_pix_no = IN.pixNoAndDataOne.x; + float data_one = IN.pixNoAndDataOne.y; + + float texel = floor(data_pix_no); + float phase = data_pix_no - texel; + float base_phase = phase - 0.5; + vec2 tex = vec2((texel + 0.5) * SourceSize.z, vTexCoord.y); + + vec3 col = vec3(0,0,0); + for (int i = -2; i <= 2; i++) + { + float phase = base_phase - float(i); + if (abs(phase) < 2.0) + { + float g = sinc(phase) * sinc(0.5 * phase); + col += texture(Source, tex + vec2(float(i) * data_one, 0.0)).rgb * g; + } + } + + return vec4(col, 1.0); + } + ENDCG + } + } +} + + + diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.shader.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Lanczos_horiz.shader.meta similarity index 80% rename from AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.shader.meta rename to AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Lanczos_horiz.shader.meta index 4957da87..6dabcf6e 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.shader.meta +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Lanczos_horiz.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d9ec870308fa2594badb4f3036d36fd5 +guid: 0ea45f89136f5e54b9a11b91e01c1fda ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Linearize.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Linearize.shader new file mode 100644 index 00000000..7c03d803 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Linearize.shader @@ -0,0 +1,41 @@ +Shader "Filter/RetroArch/Glow/Linearize" +{ + Properties + { + INPUT_GAMMA("Input Gamma",float) = 4.5 + } + SubShader + { + Pass + { + CGPROGRAM + + #pragma vertex vert_img + #pragma fragment frag + + #include "UnityCG.cginc" + #include "../FilterChain.cginc" + + float INPUT_GAMMA; + + struct v2f + { + float4 pos : POSITION; + float2 uv : TEXCOORD0; + }; + + fixed4 frag (v2f IN) : SV_Target + { + vec3 color = texture(Source, vTexCoord); + + vec4 FragColor = vec4(pow(color, vec3(INPUT_GAMMA,INPUT_GAMMA,INPUT_GAMMA)), 1.0); + + return FragColor; + } + ENDCG + } + } +} + + + diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterShaderTemplate.shader.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Linearize.shader.meta similarity index 80% rename from AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterShaderTemplate.shader.meta rename to AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Linearize.shader.meta index f1ae6490..2a64f772 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterShaderTemplate.shader.meta +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/Linearize.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 28e36f59e5007bc45bf2ab9d1ad62a02 +guid: c290b6ece8e4b724ebbf1be718265107 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_horiz.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_horiz.shader new file mode 100644 index 00000000..3ed98bde --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_horiz.shader @@ -0,0 +1,49 @@ +Shader "Filter/RetroArch/Glow/blur_horiz" +{ + Properties + { + } + SubShader + { + Pass + { + CGPROGRAM + + #pragma vertex vert_img + #pragma fragment frag + + #include "UnityCG.cginc" + #include "../FilterChain.cginc" + + #define GLOW_FALLOFF 0.35 + #define TAPS 4 + #define kernel(x) exp(-GLOW_FALLOFF * (x) * (x)) + + struct v2f + { + float4 pos : POSITION; + float2 uv : TEXCOORD0; + }; + + fixed4 frag (v2f IN) : SV_Target + { + vec3 col = vec3(0,0,0); + float dx = 4.0 * SourceSize.z; // Mipmapped + + float k_total = 0.0; + for (int i = -TAPS; i <= TAPS; i++) + { + float k = kernel(i); + k_total += k; + col += k * texture(Source, vTexCoord + vec2(float(i) * dx, 0.0)).rgb; + } + + return vec4(col / k_total, 1.0); + } + ENDCG + } + } +} + + + diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_horiz.shader.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_horiz.shader.meta new file mode 100644 index 00000000..b7405c84 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_horiz.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 55a2d5339c0bfcc48a7270d5b54a33b7 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_vert.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_vert.shader new file mode 100644 index 00000000..62506185 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_vert.shader @@ -0,0 +1,49 @@ +Shader "Filter/RetroArch/Glow/blur_vert" +{ + Properties + { + } + SubShader + { + Pass + { + CGPROGRAM + + #pragma vertex vert_img + #pragma fragment frag + + #include "UnityCG.cginc" + #include "../FilterChain.cginc" + + #define GLOW_FALLOFF 0.35 + #define TAPS 4 + #define kernel(x) exp(-GLOW_FALLOFF * (x) * (x)) + + struct v2f + { + float4 pos : POSITION; + float2 uv : TEXCOORD0; + }; + + fixed4 frag (v2f IN) : SV_Target + { + vec3 col = vec3(0,0,0); + float dy = SourceSize.w; + + float k_total = 0.0; + for (int i = -TAPS; i <= TAPS; i++) + { + float k = kernel(i); + k_total += k; + col += k * texture(Source, vTexCoord + vec2(0.0, float(i) * dy)).rgb; + } + + return vec4(col / k_total, 1.0); + } + ENDCG + } + } +} + + + diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_vert.shader.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_vert.shader.meta new file mode 100644 index 00000000..f702a99e --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/blur_vert.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6e05c280f6b465c4a8d7aba4faabb22f +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/gauss_vert.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/gauss_vert.shader new file mode 100644 index 00000000..83e4b933 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/gauss_vert.shader @@ -0,0 +1,90 @@ +Shader "Filter/RetroArch/Glow/Gauss_vert" +{ + Properties + { + BOOST("Color Boost",float) = 1.0 + } + SubShader + { + Pass + { + CGPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + #include "../FilterChain.cginc" + + float BOOST; + + struct v2f + { + float4 pos : POSITION; + float2 uv : TEXCOORD0; + float3 custom : COLOR; + }; + + v2f vert( appdata_img v ) + { + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f, o); + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.pos = UnityObjectToClipPos (v.vertex); + o.uv = v.texcoord; + + o.custom.xy = o.uv * SourceSize.xy - vec2(0.0, 0.5); + o.custom.z = SourceSize.w; + + return o; + } + + #define CRT_GEOM_BEAM 1 + + vec3 beam(vec3 color, float dist) + { + #if CRT_GEOM_BEAM + vec3 wid = 2.0 + 2.0 * pow(color, vec3(4,4,4)); + float weight = abs(dist) * 3.333333333; + vec3 weights = vec3(weight,weight,weight); + + return 2.0 * color * exp(-pow(weights * rsqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid); + #else + float reciprocal_width = 4.0; + vec3 x = dist * reciprocal_width; + + return 2.0 * color * exp(-0.5 * x * x) * reciprocal_width; + #endif + } + + fixed4 frag (v2f IN) : SV_Target + { + float2 data_pix_no = IN.custom.xy; + float data_one = IN.custom.z; + + vec2 texel = floor(data_pix_no); + float phase = data_pix_no.y - texel.y; + vec2 tex = vec2(texel + 0.5) * SourceSize.zw; + + vec3 top = texture(Source, tex + vec2(0.0, 0 * data_one)).rgb; + vec3 bottom = texture(Source, tex + vec2(0.0, 1 * data_one)).rgb; + + float dist0 = phase; + float dist1 = 1.0 - phase; + + vec3 scanline = vec3(0,0,0); + + scanline += beam(top, dist0); + scanline += beam(bottom, dist1); + + return vec4(BOOST * scanline * 0.869565217391304, 1.0); + } + ENDCG + } + } +} + + + diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/gauss_vert.shader.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/gauss_vert.shader.meta new file mode 100644 index 00000000..c6368c1f --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/gauss_vert.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 14c80468e38008142b70410db214910a +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/resolve.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/resolve.shader new file mode 100644 index 00000000..307c7bfa --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/resolve.shader @@ -0,0 +1,205 @@ +Shader "Filter/RetroArch/Glow/resolve" +{ + Properties + { + BLOOM_STRENGTH("BLOOM_STRENGTH",float) = 0.45 + OUTPUT_GAMMA("Monitor Gamma",float) = 2.2 + CURVATURE("Curvature",float) = 0 + warpX("Curvature X-Axis",float) = 0.031 + warpY("Curvature Y-Axis",float) = 0.041 + cornersize("Corner Size",float) = 0.01 + cornersmooth("Corner Smoothness",float) = 1000 + noise_amt("Noise Amount",float) = 1.0 + shadowMask("Mask Effect",float) = 0.0 + maskDark("maskDark",float) = 0.5 + maskLight("maskLight",float) = 1.5 + } + SubShader + { + Pass + { + CGPROGRAM + + #pragma vertex vert_img + #pragma fragment frag + + #include "UnityCG.cginc" + #include "../FilterChain.cginc" + + #define iTime mod(float(FrameCount) / 60.0, 600.0) + #define fragCoord (vTexCoord.xy * OutputSize.xy) + // For debugging + #define BLOOM_ONLY 0 + + #define CRT_PASS CRTPass + + sampler2D CRTPass; + float BLOOM_STRENGTH; + float OUTPUT_GAMMA; + float CURVATURE; + float warpX; + float warpY; + float cornersize; + float cornersmooth; + float noise_amt; + float shadowMask; + float maskDark; + float maskLight; + + struct v2f + { + float4 pos : POSITION; + float2 uv : TEXCOORD0; + }; + + + + // Convert from linear to sRGB. + vec4 Srgb(vec4 c){ + float temp = 1.0/2.2; + return pow(c, vec4(temp,temp,temp,temp)); + } + // Convert from sRGB to linear. + float Linear(float c){return pow(c, 2.2);} + + float rand(vec2 n) { + return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453); + } + + float noise(vec2 p){ + vec2 ip = floor(p); + vec2 u = fract(p); + u = u*u*(3.0-2.0*u); + + float res = mix( + mix(rand(ip),rand(ip+vec2(1.0,0.0)),u.x), + mix(rand(ip+vec2(0.0,1.0)),rand(ip+vec2(1.0,1.0)),u.x),u.y); + return res*res; + } + + const vec2 corner_aspect = vec2(1.0, 0.75); + + float corner(vec2 coord) + { + coord = (coord - vec2(0.5,0.5)) + vec2(0.5, 0.5); + coord = min(coord, vec2(1.0,1.0) - coord) * corner_aspect; + vec2 cdist = vec2(cornersize,cornersize); + coord = (cdist - min(coord, cdist)); + float dist = sqrt(dot(coord, coord)); + + return clamp((cdist.x - dist)*cornersmooth, 0.0, 1.0); + } + + vec2 Warp(float Distortion,vec2 position,vec2 texCoord){ + float offset_x = noise(sin(position.xy) * float(mod(FrameCount, 361.))); + float offset_y = noise(cos(position.yx) * float(mod(FrameCount, 873.))); + vec2 noisecoord = texCoord + vec2(offset_x, offset_y) * 0.001 * noise_amt; + vec2 curvedCoords = noisecoord * 2.0 - 1.0; + float curvedCoordsDistance = sqrt(curvedCoords.x*curvedCoords.x+curvedCoords.y*curvedCoords.y); + + curvedCoords = curvedCoords / curvedCoordsDistance; + + float temp = 1.0-(curvedCoordsDistance/1.4142135623730950488016887242097); + float2 powP1 = float2(temp,temp); + float powP2 = 1.0 / (1.0 + Distortion * 0.2 ); + curvedCoords = curvedCoords * (1.0-pow(powP1,powP2)); + + curvedCoords = curvedCoords / (1.0-pow(vec2(0.29289321881345247559915563789515,0.29289321881345247559915563789515),(1.0/(vec2(1.0,1.0)+Distortion*0.2)))); + + curvedCoords = curvedCoords * 0.5 + 0.5; + return curvedCoords; + } + + // Shadow mask. + vec3 Mask(vec2 pos) + { + vec3 mask = vec3(maskDark, maskDark, maskDark); + + // Very compressed TV style shadow mask. + if (shadowMask == 1.0) + { + float line = maskLight; + float odd = 0.0; + + if (fract(pos.x*0.166666666) < 0.5) odd = 1.0; + if (fract((pos.y + odd) * 0.5) < 0.5) line = maskDark; + + pos.x = fract(pos.x*0.333333333); + + if (pos.x < 0.333) mask.r = maskLight; + else if (pos.x < 0.666) mask.g = maskLight; + else mask.b = maskLight; + mask*=line; + } + + // Aperture-grille. + else if (shadowMask == 2.0) + { + pos.x = fract(pos.x*0.333333333); + + if (pos.x < 0.333) mask.r = maskLight; + else if (pos.x < 0.666) mask.g = maskLight; + else mask.b = maskLight; + } + + // Stretched VGA style shadow mask (same as prior shaders). + else if (params.shadowMask == 3.0) + { + pos.x += pos.y*3.0; + pos.x = fract(pos.x*0.166666666); + + if (pos.x < 0.333) mask.r = params.maskLight; + else if (pos.x < 0.666) mask.g = params.maskLight; + else mask.b = params.maskLight; + } + + // VGA style shadow mask. + else if (params.shadowMask == 4.0) + { + pos.xy = floor(pos.xy*vec2(1.0, 0.5)); + pos.x += pos.y*3.0; + pos.x = fract(pos.x*0.166666666); + + if (pos.x < 0.333) mask.r = params.maskLight; + else if (pos.x < 0.666) mask.g = params.maskLight; + else mask.b = params.maskLight; + } + + return mask; + } + + fixed4 frag (v2f IN) : SV_Target + { + float Distortion = vec2(warpX, warpY) * 15; + + float4 FragColor = float4(0,0,0,1); + vec2 pp = vTexCoord.xy; + pp = (params.CURVATURE > 0.5) ? Warp(IN.pos,pp) : pp; + + #if BLOOM_ONLY + vec3 source = BLOOM_STRENGTH * texture(Source, pp).rgb; + #else + + vec3 source = 1.15 * texture(CRT_PASS, pp).rgb; + vec3 bloom = texture(Source, pp).rgb; + source += params.BLOOM_STRENGTH * bloom; + #endif + FragColor = vec4(pow(clamp(source, 0.0, 1.0), vec3(1.0 / params.OUTPUT_GAMMA)), 1.0); + /* TODO/FIXME - hacky clamp fix */ + if ( pp.x > 0.0001 && pp.x < 0.9999 && pp.y > 0.0001 && pp.y < 0.9999) + FragColor.rgb = FragColor.rgb; + else + FragColor.rgb = vec3(0.0); + FragColor.rgb *= (params.CURVATURE > 0.5) ? corner(pp) : 1.0; + if (params.shadowMask > 0.0) + FragColor.rgb = pow(pow(FragColor.rgb, vec3(2.2)) * Mask(vTexCoord.xy * global.OutputSize.xy * 1.000001), vec3(1.0 / 2.2)); + + return FragColor; + } + ENDCG + } + } +} + + + diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/resolve.shader.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/resolve.shader.meta new file mode 100644 index 00000000..99057ac8 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/resolve.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f56f4a93b57b7f54d850c59d6368f37a +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/threshold.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/threshold.shader new file mode 100644 index 00000000..ff41a48a --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/threshold.shader @@ -0,0 +1,42 @@ +Shader "Filter/RetroArch/Glow/threshold" +{ + Properties + { + GLOW_WHITEPOINT("Glow Whitepoint",float) = 1.0 + GLOW_ROLLOFF("Glow Rolloff",float) = 3.0 + } + SubShader + { + Pass + { + CGPROGRAM + + #pragma vertex vert_img + #pragma fragment frag + + #include "UnityCG.cginc" + #include "../FilterChain.cginc" + + float GLOW_WHITEPOINT; + float GLOW_ROLLOFF; + + struct v2f + { + float4 pos : POSITION; + float2 uv : TEXCOORD0; + }; + + fixed4 frag (v2f IN) : SV_Target + { + vec3 color = 1.15 * texture(Source, vTexCoord).rgb; + vec3 factor = clamp(color / GLOW_WHITEPOINT, 0.0, 1.0); + + return vec4(pow(factor, vec3(GLOW_ROLLOFF,GLOW_ROLLOFF,GLOW_ROLLOFF)), 1.0); + } + ENDCG + } + } +} + + + diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/threshold.shader.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/threshold.shader.meta new file mode 100644 index 00000000..3fbe7fe9 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/Crtglow-Lanczos/threshold.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d41324e881de00c45b527d919ed2b636 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChain.cginc b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChain.cginc new file mode 100644 index 00000000..2c2d7778 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChain.cginc @@ -0,0 +1,17 @@ +#define vec2 float2 +#define vec3 float3 +#define vec4 float4 +#define texture(tex,uv) tex2D(tex,uv) +#define vTexCoord IN.uv +#define fract frac +#define mix lerp +#define mod(x,y) x%y + +float sinc(float x) { if (x == 0) { return 1.0; } else { return sin(x) / x; } } + +sampler2D Original; +float4 OriginalSize; +sampler2D Source; +float4 SourceSize; +float4 OutputSize; +float FrameCount; \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/blur_params.cginc.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChain.cginc.meta similarity index 75% rename from AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/blur_params.cginc.meta rename to AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChain.cginc.meta index 8d5d2cd7..809f3c8b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/blur_params.cginc.meta +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChain.cginc.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8e15245c3d9a7ba4ab348d97af4d5cea +guid: b1fa889ae5b319140943db562bd5fc94 ShaderIncludeImporter: externalObjects: {} userData: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChainEffect.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChainEffect.cs index adc518ef..d6a19527 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChainEffect.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterChainEffect.cs @@ -1,18 +1,19 @@ using AxibugEmuOnline.Client; -using System; using System.Collections.Generic; using UnityEngine; -using UnityEngine.Rendering; +using UnityEngine.Experimental.Rendering; public abstract class FilterChainEffect : FilterEffect { #region SealedForDisable protected sealed override string ShaderName => null; protected sealed override void OnInit(Material renderMat) { } - protected sealed override void OnRenderer(Material renderMat, Texture src, RenderTexture result) - { + + public sealed override void Render(Texture src, RenderTexture result) + { OnRenderer(src, result); } + protected sealed override void OnRenderer(Material renderMat, Texture src, RenderTexture result) { } #endregion List m_passes = new List(); @@ -21,8 +22,11 @@ public abstract class FilterChainEffect : FilterEffect static int OriginalSize; static int Source; static int SourceSize; + static int FrameCount; + static int OutputSize; List m_passOutputTexNames = new List(); + List m_passOutputTexSizes = new List(); static FilterChainEffect() { @@ -30,6 +34,8 @@ public abstract class FilterChainEffect : FilterEffect OriginalSize = Shader.PropertyToID(nameof(OriginalSize)); Source = Shader.PropertyToID(nameof(Source)); SourceSize = Shader.PropertyToID(nameof(SourceSize)); + FrameCount = Shader.PropertyToID(nameof(FrameCount)); + OutputSize = Shader.PropertyToID(nameof(OutputSize)); } protected sealed override void Init() @@ -39,8 +45,12 @@ public abstract class FilterChainEffect : FilterEffect { m_passes[i].Init(i); m_passOutputTexNames.Add(Shader.PropertyToID(m_passes[i].NormalOutputTextureName)); - if (m_passes[i].AliasOutputTextureName != null) - m_passOutputTexNames.Add(Shader.PropertyToID(m_passes[i].AliasOutputTextureName)); + m_passOutputTexSizes.Add(Shader.PropertyToID($"{m_passes[i].NormalOutputTextureName}Size")); + if (m_passes[i].AliasOutputTextureName != null) + { + m_passOutputTexNames.Add(Shader.PropertyToID(m_passes[i].AliasOutputTextureName)); + m_passOutputTexSizes.Add(Shader.PropertyToID($"{m_passes[i].AliasOutputTextureName}Size")); + } } } @@ -59,14 +69,25 @@ public abstract class FilterChainEffect : FilterEffect pass.Mat.SetTexture(Original, input); pass.Mat.SetVector(OriginalSize, originalSize); pass.Mat.SetTexture(Source, lastoutput); - pass.Mat.SetVector(SourceSize, new Vector4(lastoutput.width, lastoutput.height, 1f / lastoutput.width, 1f / lastoutput.height)); - foreach (var existoutput in m_passOutputTexNames) + pass.Mat.SetVector(SourceSize, new Vector4(lastoutput.width, lastoutput.height, 1f / lastoutput.width, 1f / lastoutput.height)); + pass.Mat.SetFloat(FrameCount, Time.frameCount); + + for (int index = 0; index < m_passOutputTexNames.Count; index++) { - if (pass.Mat.HasTexture(existoutput) && m_outputCaches.TryGetValue(existoutput, out var passOutput)) - pass.Mat.SetTexture(existoutput, passOutput); + var existoutput = m_passOutputTexNames[index]; + var existoutputSize = m_passOutputTexSizes[index]; + if (m_outputCaches.TryGetValue(existoutput, out var passOutput)) + { + if (pass.Mat.HasTexture(existoutput)) + pass.Mat.SetTexture(existoutput, passOutput); + if (pass.Mat.HasVector(existoutputSize)) + pass.Mat.SetVector(existoutputSize, new Vector4(passOutput.width, passOutput.height, 1f / passOutput.width, 1f / passOutput.height)); + } } - var output = pass.GetOutput(input, lastoutput, finalOut); + var output = pass.GetOutput(input, lastoutput, finalOut); + + pass.Mat.SetVector(OutputSize, new Vector4(output.width, output.height, 1f / output.width, 1f / output.height)); m_outputCaches[pass.NormalOutputTextureName_PID] = output; if (pass.AliasOutputTextureName != null) m_outputCaches[pass.AliasOutputTextureName_PID] = output; @@ -82,17 +103,19 @@ public abstract class FilterChainEffect : FilterEffect protected abstract void DefinePasses(ref List passes); public class PassDefine - { + { public string ShaderName { get; private set; } public FilterMode FilterMode { get; private set; } public TextureWrapMode WrapMode { get; private set; } - public EnumScaleMode ScaleMode { get; private set; } + public EnumScaleMode ScaleModeX { get; private set; } + public EnumScaleMode ScaleModeY { get; private set; } public float ScaleX { get; private set; } public float ScaleY { get; private set; } public string AliasOutputTextureName { get; private set; } public int AliasOutputTextureName_PID { get; private set; } public string NormalOutputTextureName { get; private set; } public int NormalOutputTextureName_PID { get; private set; } + public bool sRGB { get; private set; } private PassDefine() { } @@ -100,8 +123,9 @@ public abstract class FilterChainEffect : FilterEffect string shaderName, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Clamp, - EnumScaleMode scaleMode = EnumScaleMode.Source, float scaleX = 1f, float scaleY = 1f, - string outputAlias = null + EnumScaleMode scaleModeX = EnumScaleMode.Source, EnumScaleMode scaleModeY = EnumScaleMode.Source, float scaleX = 1f, float scaleY = 1f, + string outputAlias = null, + bool sRGB = false ) { return new PassDefine() @@ -109,15 +133,19 @@ public abstract class FilterChainEffect : FilterEffect ShaderName = shaderName, FilterMode = filterMode, WrapMode = wrapMode, - ScaleMode = scaleMode, + ScaleModeX = scaleModeX, + ScaleModeY = scaleModeY, ScaleX = scaleX, ScaleY = scaleY, AliasOutputTextureName = outputAlias, + sRGB = sRGB, }; } public int PassIndex { get; private set; } - public Material Mat { get; private set; } + public Material Mat { get; private set; } + + internal void Init(int passIndex) { Mat = new Material(Shader.Find(ShaderName)); @@ -131,23 +159,36 @@ public abstract class FilterChainEffect : FilterEffect internal RenderTexture GetOutput(Texture original, Texture source, Texture final) { int width = 0; - int height = 0; - switch (ScaleMode) + switch (ScaleModeX) { case EnumScaleMode.Viewport: width = (int)(final.width * ScaleX); - height = (int)(final.height * ScaleY); break; case EnumScaleMode.Source: width = (int)(source.width * ScaleX); - height = (int)(source.height * ScaleY); break; case EnumScaleMode.Absolute: width = (int)ScaleX; + break; + } + int height = 0; + switch (ScaleModeY) + { + case EnumScaleMode.Viewport: + height = (int)(final.height * ScaleY); + break; + case EnumScaleMode.Source: + height = (int)(source.height * ScaleY); + break; + case EnumScaleMode.Absolute: height = (int)ScaleY; break; } - var rt = RenderTexture.GetTemporary(width, height); + + GraphicsFormat format = GraphicsFormat.R8G8B8A8_UNorm; + if (sRGB) format = GraphicsFormat.R8G8B8A8_SRGB; + var rt = RenderTexture.GetTemporary(width, height, 0, format, 1); + rt.wrapMode = WrapMode; rt.filterMode = FilterMode; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterEffect.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterEffect.cs index d0f194d6..edbf0ba1 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterEffect.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterEffect.cs @@ -63,7 +63,7 @@ namespace AxibugEmuOnline.Client } } - public void Render(Texture src, RenderTexture result) + public virtual void Render(Texture src, RenderTexture result) { m_material.SetVector(m_iResolutionID, new Vector4(result.width, result.height)); OnRenderer(m_material, src, result); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs index 79b038d3..d02cca7a 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterManager.cs @@ -1,5 +1,4 @@ using AxibugEmuOnline.Client.ClientCore; -using Sony.Vita.Dialog; using System; using System.Collections.Generic; using System.Linq; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArchMattiasCRTGlow.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArchMattiasCRTGlow.cs deleted file mode 100644 index 23282ff7..00000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArchMattiasCRTGlow.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Assets.Script.AppMain.Filter; -using AxibugEmuOnline.Client; -using UnityEngine; -using UnityEngine.Rendering; - -[Strip(RuntimePlatform.PSP2)] -public class RetroArchMattiasCRTGlow : FilterEffect -{ - public override string Name => nameof(RetroArchMattiasCRTGlow); - protected override string ShaderName => "Filter/RetroArch/MattiasCRTWithGlow"; - - [Range(0.02f, 20f)] - public FloatParameter InputGamma = new FloatParameter(11); - [Range(0.02f, 1f)] - public FloatParameter GaussianWidth = new FloatParameter(0.4f); - [Range(0.02f, 1f)] - public FloatParameter ColorBoost = new FloatParameter(0.4f); - [Range(0.02f, 1f)] - public FloatParameter GlowWhitePoint = new FloatParameter(0.4f); - [Range(0.1f, 6f)] - public FloatParameter GlowRolloff = new FloatParameter(2.2f); - [Range(0.05f, 0.8f)] - public FloatParameter GlowStrength = new FloatParameter(0.45f); - [Range(0.02f, 2.6f)] - public FloatParameter MonitorGamma = new FloatParameter(2.2f); - - int m_gamma_ID = Shader.PropertyToID("_gamma"); - int m_horiz_gauss_width_ID = Shader.PropertyToID("_horiz_gauss_width"); - int m_BOOST_ID = Shader.PropertyToID("_BOOST"); - int m_GLOW_WHITEPOINT_ID = Shader.PropertyToID("_GLOW_WHITEPOINT"); - int m_GLOW_ROLLOFF_ID = Shader.PropertyToID("_GLOW_ROLLOFF"); - int m_BLOOM_STRENGTH_ID = Shader.PropertyToID("_BLOOM_STRENGTH"); - int m_OUTPUT_GAMMA_ID = Shader.PropertyToID("_OUTPUT_GAMMA"); - - - CommandBuffer m_multipPassCmd; - int m_wrapRT; - - protected override void OnInit(Material renderMat) - { - m_multipPassCmd = new CommandBuffer(); - m_wrapRT = Shader.PropertyToID($"{Name}.WrapRT"); - } - - protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result) - { - m_multipPassCmd.Clear(); - - m_multipPassCmd.GetTemporaryRT(m_wrapRT, result.width, result.height); - - renderMat.SetFloat(m_gamma_ID, InputGamma.GetValue()); - renderMat.SetFloat(m_horiz_gauss_width_ID, GaussianWidth.GetValue()); - renderMat.SetFloat(m_BOOST_ID, ColorBoost.GetValue()); - renderMat.SetFloat(m_GLOW_WHITEPOINT_ID, GlowWhitePoint.GetValue()); - renderMat.SetFloat(m_GLOW_ROLLOFF_ID, GlowRolloff.GetValue()); - renderMat.SetFloat(m_BLOOM_STRENGTH_ID, GlowStrength.GetValue()); - renderMat.SetFloat(m_OUTPUT_GAMMA_ID, MonitorGamma.GetValue()); - - m_multipPassCmd.Blit(src, result); - for (int i = 0; i < renderMat.shader.passCount; i++) - { - m_multipPassCmd.Blit(result, m_wrapRT, renderMat, i); - m_multipPassCmd.Blit(m_wrapRT, result); - } - - m_multipPassCmd.ReleaseTemporaryRT(m_wrapRT); - Graphics.ExecuteCommandBuffer(m_multipPassCmd); - } -} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArchMattiasCRTGlow.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArchMattiasCRTGlow.cs.meta deleted file mode 100644 index b1031e57..00000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArchMattiasCRTGlow.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: fb6622dcbc754b744bb70f1655c3e526 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.mat b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.mat deleted file mode 100644 index 92d491c0..00000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.mat +++ /dev/null @@ -1,41 +0,0 @@ -%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: RetroArch_Glow - m_Shader: {fileID: 4800000, guid: d9ec870308fa2594badb4f3036d36fd5, type: 3} - m_Parent: {fileID: 0} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: [] - m_InvalidKeywords: [] - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _MainTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: [] - m_Floats: - - _BLOOM_STRENGTH: 0.45 - - _BOOST: 0.4 - - _GLOW_ROLLOFF: 2.2 - - _GLOW_WHITEPOINT: 0.4 - - _OUTPUT_GAMMA: 2.2 - - _gamma: 11 - - _horiz_gauss_width: 0.4 - m_Colors: [] - m_BuildTextureStacks: [] - m_AllowLocking: 1 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.mat.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.mat.meta deleted file mode 100644 index 0be4b59e..00000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5965751351debd6499aa27660a1bc92e -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 2100000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.shader deleted file mode 100644 index 0e35dd63..00000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/RetroArch_Glow.shader +++ /dev/null @@ -1,394 +0,0 @@ -Shader "Filter/RetroArch/MattiasCRTWithGlow" -{ - Properties - { - _MainTex ("Texture", 2D) = "white" - _gamma("Input Gamma option: 2.4/2.0/2.6/0.02",float) = 11 - _horiz_gauss_width("Gaussian Width option: 0.5/0.4/0.6/0.02",float) = 0.4 - _BOOST("Color Boost option: 1.0/0.5/1.5/0.02",float) = 0.4 - _GLOW_WHITEPOINT("Glow Whitepoint option: 1.0/0.5/1.1/0.02",float) = 0.4 - _GLOW_ROLLOFF("Glow Rolloff option: 3.0 1.2 6.0 0.1",float) = 2.2 - _BLOOM_STRENGTH("Glow Strength option: 0.45/0.0/0.8/0.05",float) = 0.45 - _OUTPUT_GAMMA("Monitor Gamma option: 2.2/1.8/2.6/0.02",float) = 2.2 - } - SubShader - { - Pass - { - Name "linearize" - - CGPROGRAM - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - half _gamma; - sampler2D _MainTex; - float2 _iResolution; - - struct v2f - { - float4 pos : POSITION; - float2 uv : TEXCOORD0; - }; - - - fixed4 frag(v2f i) : SV_Target - { - fixed3 color = tex2D(_MainTex,i.uv); - fixed4 result = fixed4(pow(color,_gamma),1.0); - return result; - } - ENDCG - } - - Pass - { - Name "MattiasCRT" - - CGPROGRAM - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _MainTex; - float2 _iResolution; - - struct v2f - { - float4 pos : POSITION; - float2 uv : TEXCOORD0; - }; - - float2 curve(float2 uv) - { - uv = (uv - 0.5) * 2.0; - uv *= 1.1; - uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0); - uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0); - uv = (uv / 2.0) + 0.5; - uv = uv *0.92 + 0.04; - return uv; - } - - float4 mainImage( float2 fragCoord ) - { - - float4 fragColor = float4(0,0,0,1); - - float2 q = fragCoord.xy / _iResolution.xy; - float2 uv = q; - uv = curve( uv ); - float x = sin(0.3*_Time+uv.y*21.0)*sin(0.7*_Time+uv.y*29.0)*sin(0.3+0.33*_Time+uv.y*31.0)*0.0017; - - float3 col; - col.r = tex2D(_MainTex,float2(x+uv.x+0.001,uv.y+0.001)).x+0.05; - col.g = tex2D(_MainTex,float2(x+uv.x+0.000,uv.y-0.002)).y+0.05; - col.b = tex2D(_MainTex,float2(x+uv.x-0.002,uv.y+0.000)).z+0.05; - col.r += 0.08*tex2D(_MainTex,0.75*float2(x+0.025, -0.027)+float2(uv.x+0.001,uv.y+0.001)).x; - col.b += 0.08*tex2D(_MainTex,0.75*float2(x+-0.02, -0.018)+float2(uv.x-0.002,uv.y+0.000)).z; - col.g += 0.05*tex2D(_MainTex,0.75*float2(x+-0.022, -0.02)+float2(uv.x+0.000,uv.y-0.002)).y; - - - col = clamp(col*0.6+0.4*col*col*1.0,0.0,1.0); - - float vig = (0.0 + 1.0*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y)); - col *= pow(vig,0.3); - - col *= float3(0.95,1.05,0.95); - col *= 2.8; - - float scans = clamp( 0.35+0.35*sin(3.5*_Time+uv.y*_iResolution.y*1.5), 0.0, 1.0); - - float s = pow(scans,1.7); - col = col*( 0.4+0.7*s) ; - - col *= 1.0+0.01*sin(110.0*_Time); - if (uv.x < 0.0 || uv.x > 1.0) - col *= 0.0; - if (uv.y < 0.0 || uv.y > 1.0) - col *= 0.0; - - - col*=1.0-0.65*clamp((fragCoord.x % 2.0 -1.0 )*2.0,0.0,1.0); - - float comp = smoothstep( 0.1, 0.9, sin(_Time) ); - - fragColor = float4(col,1.0); - - return fragColor; - } - - fixed4 frag(v2f i) : SV_Target - { - float2 pos = _iResolution.xy*i.uv; - fixed4 col = mainImage(pos); - return col; - } - ENDCG - } - - Pass - { - Name "gauss_horiz" - - CGPROGRAM - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - #define INV_SQRT_2_PI 0.38 - - sampler2D _MainTex; - float2 _iResolution; - float _horiz_gauss_width; - - struct v2f - { - float4 pos : POSITION; - float2 uv : TEXCOORD0; - }; - - fixed4 gauss_horiz(v2f IN){ - float one = 1.0/_iResolution.x; - float pix_no = _iResolution.x*IN.uv.x; - float texel = floor(pix_no); - float phase = pix_no-texel; - float base_phase = phase - 0.5; - float2 tex = float2((texel+0.5)/_iResolution.x,IN.uv.y); - - #define TEX(off_x) tex2D(_MainTex, IN.uv + float2(float(off_x) * one, 0.0)).rgb - - float3 col = float3(0,0,0); - for(int i=-2;i<=2;i++){ - float phase = base_phase - float(i); - float g = INV_SQRT_2_PI * exp(-0.5 * phase * phase / (_horiz_gauss_width * _horiz_gauss_width)) / _horiz_gauss_width; - col+=TEX(i)*g; - } - - return fixed4(col,1); - } - - fixed4 frag (v2f i) : SV_Target - { - fixed4 color=gauss_horiz(i); - - return color; - } - ENDCG - } - - Pass - { - Name "gauss_vert" - - CGPROGRAM - - #pragma shader_feature_local _CRT_GEOM_ON _CRT_GEOM_OFF - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _MainTex; - float2 _iResolution; - float _BOOST; - - struct v2f - { - float4 pos : POSITION; - float2 uv : TEXCOORD0; - }; - - float3 beam(float3 color,float dist){ - #if CRT_GEOM_BEAM - float3 wid = 2.0 + 2.0 * pow(color, 4.0); - float3 weights = float3(abs(dist) / 0.3); - return 2.0 * color * exp(-pow(weights * rsqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid); - #else - const float width = 0.25; - float3 x = dist / width; - return 2.0 * color * exp(-0.5 * x * x) / width; - #endif - } - - fixed4 frag(v2f IN) : SV_Target - { - float2 pix_no = IN.uv*_iResolution - float2(0,0.5); - float one = 1.0/ _iResolution.y; - - #define TEX(off_y) tex2D(_MainTex, IN.uv + float2(0.0, off_y * one)).rgb - - float2 texel = floor(pix_no); - float phase = pix_no.y - texel.y; - float2 tex = float2(texel + 0.5) / _iResolution; - - float3 top = TEX(0); - float3 bottom = TEX(1); - - float dist0 = phase; - float dist1 = 1.0 - phase; - - float3 scanline = float3(0,0,0); - - scanline += beam(top, dist0); - scanline += beam(bottom, dist1); - - return float4(_BOOST * scanline / 1.15, 1.0); - } - ENDCG - } - - Pass - { - Name "threshold" - - CGPROGRAM - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _MainTex; - float2 _iResolution; - - float _GLOW_WHITEPOINT; - float _GLOW_ROLLOFF; - - struct v2f - { - float4 pos : POSITION; - float2 uv : TEXCOORD0; - }; - - float4 frag(v2f IN) : SV_Target - { - float3 color = 1.15*tex2D(_MainTex,IN.uv).rgb; - float3 factor = saturate(color / _GLOW_WHITEPOINT); - return float4(pow(factor,_GLOW_ROLLOFF),1.0); - } - ENDCG - } - - Pass - { - Name "blur_horiz" - - CGPROGRAM - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _MainTex; - float2 _iResolution; - - struct v2f - { - float4 pos : POSITION; - float2 uv : TEXCOORD0; - }; - - #include "blur_params.cginc" - #define kernel(x) exp(-GLOW_FALLOFF * (x) * (x)) - - float4 frag(v2f IN) : SV_Target - { - float3 col = float3(0,0,0); - float dx = 4.0 / _iResolution.x; // Mipmapped - - float k_total = 0.0; - for (int i = -TAPS; i <= TAPS; i++) - { - float k = kernel(i); - k_total += k; - col += k * tex2D(_MainTex, IN.uv + float2(float(i) * dx, 0.0)).rgb; - } - return float4(col / k_total, 1.0); - } - ENDCG - } - - Pass - { - Name "blur_vert" - - CGPROGRAM - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _MainTex; - float2 _iResolution; - - struct v2f - { - float4 pos : POSITION; - float2 uv : TEXCOORD0; - }; - - #include "blur_params.cginc" - #define kernel(x) exp(-GLOW_FALLOFF * (x) * (x)) - - float4 frag(v2f IN) : SV_Target - { - float3 col = float3(0,0,0); - float dy = 1.0 / _iResolution.y; - - float k_total = 0.0; - for (int i = -TAPS; i <= TAPS; i++) - { - float k = kernel(i); - k_total += k; - col += k * tex2D(_MainTex, IN.uv + float2(0.0, float(i) * dy)).rgb; - } - return float4(col / k_total, 1.0); - } - ENDCG - } - - Pass - { - Name "resolve" - - CGPROGRAM - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _MainTex; - sampler2D _Source; - float2 _iResolution; - - float _BLOOM_STRENGTH; - float _OUTPUT_GAMMA; - - struct v2f - { - float4 pos : POSITION; - float2 uv : TEXCOORD0; - }; - - float4 frag(v2f IN) : SV_Target - { - #if 1 - float3 source = _BLOOM_STRENGTH * tex2D(_MainTex,IN.uv).rgb; - #else - float3 source = 1.15 * tex2D(_Source,IN.uv).rgb; - float3 bloom = tex2D(_MainTex,IN.uv).rgb; - source += _BLOOM_STRENGTH * bloom; - #endif - return float4(pow(saturate(source), 1.0 / _OUTPUT_GAMMA), 1.0); - } - ENDCG - } - } -} - - - diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/blur_params.cginc b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/blur_params.cginc deleted file mode 100644 index 120c2346..00000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/RetroArch_Glow/blur_params.cginc +++ /dev/null @@ -1,4 +0,0 @@ -// Higher value, more centered glow. -// Lower values might need more taps. -#define GLOW_FALLOFF 0.35 -#define TAPS 4 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterShaderTemplate.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/ShaderTEMPLATE.shader.bak similarity index 69% rename from AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterShaderTemplate.shader rename to AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/ShaderTEMPLATE.shader.bak index f76643c8..10290108 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/FilterShaderTemplate.shader +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/ShaderTEMPLATE.shader.bak @@ -1,9 +1,8 @@ - -Shader "Hidden/TEMPLATE" +Shader "HIDDEN/FILTERTEMPLATE" { Properties { - _MainTex ("Base (RGB)", 2D) = "white" {} + } SubShader { @@ -13,9 +12,9 @@ Shader "Hidden/TEMPLATE" #pragma vertex vert_img #pragma fragment frag - #include "UnityCG.cginc" - sampler2D _MainTex; + #include "UnityCG.cginc" + #include "../FilterChain.cginc" struct v2f { @@ -23,7 +22,7 @@ Shader "Hidden/TEMPLATE" float2 uv : TEXCOORD0; }; - fixed4 frag (v2f i) : SV_Target + fixed4 frag (v2f IN) : SV_Target { return fixed4(1,1,1,1); } diff --git a/AxibugEmuOnline.Client/Assets/Scene/TestFilter.unity.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/ShaderTEMPLATE.shader.bak.meta similarity index 74% rename from AxibugEmuOnline.Client/Assets/Scene/TestFilter.unity.meta rename to AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/ShaderTEMPLATE.shader.bak.meta index ede26b33..9b19471d 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/TestFilter.unity.meta +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppSettings/Filter/ShaderTEMPLATE.shader.bak.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7053096623e85d842aa0a92bcc9944ea +guid: 3480f0318898c9b4c88c90b2545cf4c7 DefaultImporter: externalObjects: {} userData: diff --git a/AxibugEmuOnline.Client/Assets/Script/TestFilter.cs b/AxibugEmuOnline.Client/Assets/Script/TestFilter.cs deleted file mode 100644 index da04536d..00000000 --- a/AxibugEmuOnline.Client/Assets/Script/TestFilter.cs +++ /dev/null @@ -1,50 +0,0 @@ -#if UNITY_EDITOR -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.UI; - -[ExecuteInEditMode] -public class TestFilter : MonoBehaviour -{ - public Material filterMat; - public RawImage img; - public Texture2D source; - - private RenderTexture rt; - private RenderTexture rtWrap; - - private void Update() - { - if (rt == null) - { - rt = RenderTexture.GetTemporary(Screen.width, Screen.height); - rtWrap = RenderTexture.GetTemporary(Screen.width, Screen.height); - } - else if (rt.width != Screen.width || rt.height != Screen.height) - { - RenderTexture.ReleaseTemporary(rt); - RenderTexture.ReleaseTemporary(rtWrap); - - rt = RenderTexture.GetTemporary(Screen.width, Screen.height); - rtWrap = RenderTexture.GetTemporary(Screen.width, Screen.height); - } - - filterMat.SetVector("_iResolution", new Vector2(rt.width, rt.height)); - filterMat.SetTexture("_Source", source); - - CommandBuffer cmd = new CommandBuffer(); - { - cmd.Blit(source, rt); - for (int i = 0; i < filterMat.shader.passCount; i++) - { - cmd.Blit(rt, rtWrap, filterMat, i); - cmd.Blit(rtWrap, rt); - } - } - Graphics.ExecuteCommandBuffer(cmd); - //cmd.Release(); - - img.texture = rt; - } -} -#endif diff --git a/AxibugEmuOnline.Client/Assets/Script/TestFilter.cs.meta b/AxibugEmuOnline.Client/Assets/Script/TestFilter.cs.meta deleted file mode 100644 index c1453a5d..00000000 --- a/AxibugEmuOnline.Client/Assets/Script/TestFilter.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 40d1396d19f4da44f98dd2fcf6f0bc56 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/ProjectSettings/GraphicsSettings.asset b/AxibugEmuOnline.Client/ProjectSettings/GraphicsSettings.asset index 5433b75a..57317bda 100644 --- a/AxibugEmuOnline.Client/ProjectSettings/GraphicsSettings.asset +++ b/AxibugEmuOnline.Client/ProjectSettings/GraphicsSettings.asset @@ -25,7 +25,7 @@ GraphicsSettings: m_LensFlare: m_Mode: 1 m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} - m_VideoShadersIncludeMode: 2 + m_VideoShadersIncludeMode: 1 m_AlwaysIncludedShaders: - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} @@ -34,9 +34,6 @@ GraphicsSettings: - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} - - {fileID: 4800000, guid: 5dd9160e7dde4dd4db07347ce4780217, type: 3} - - {fileID: 4800000, guid: 57c38351364c92e45aef2dc17245b3ce, type: 3} - - {fileID: 4800000, guid: bab7d8f2e62367743930d118a37e824a, type: 3} m_PreloadedShaders: [] m_PreloadShadersBatchTimeLimit: -1 m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}