This commit is contained in:
NimXD
2024-09-26 20:53:03 +05:30
parent dfe47c1fb8
commit c29b03d428
212 changed files with 291654 additions and 1622 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e9f13376bfa231e4997216ef806941a2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,102 @@
#ifndef UI_BLUR_CGINC
#define UI_BLUR_CGINC
#include "UnityCG.cginc"
// Pixel size.
static const float2 ps = _ScreenParams.zw - 1.0;
// Parameters.
sampler2D _MainTex;
float _Opacity, _Size;
// Functions.
// Creates a linear blur from a projected texture.
// The blur is made centered, so the direction is always absolute.
// sp - Texture sampler.
// uv - Texture coordinates.
// dir - Blur direction vector.
float4 linear_blur(sampler2D sp, float4 uv, float2 dir) {
static const int samples = 9;
float4 color = 0.0;
// Move coordinates in opposite direction to center the sampling.
uv = UNITY_PROJ_COORD(float4(
uv.x - dir.x * samples * 0.5,
uv.y - dir.y * samples * 0.5,
uv.z,
uv.w
));
[unroll]
for (int i = 0; i < samples; ++i) {
uv = UNITY_PROJ_COORD(float4(
uv.x + dir.x,
uv.y + dir.y,
uv.z,
uv.w
));
color += tex2Dproj(sp, uv);
}
return color / samples;
}
// Vertex shaders.
void VS_Quad(
float4 v : POSITION,
out float4 p : SV_POSITION,
inout float2 uv : TEXCOORD
) {
p = UnityObjectToClipPos(v);
}
void VS_QuadProj(
float4 v : POSITION,
out float4 p : SV_POSITION,
inout float2 uv1 : TEXCOORD0,
out float4 uv2 : TEXCOORD1
) {
VS_Quad(v, p, uv1);
uv2 = ComputeGrabScreenPos(p);
}
void VS_QuadProjColor(
float4 v : POSITION,
out float4 p : SV_POSITION,
inout float2 uv1 : TEXCOORD0,
out float4 uv2 : texcoord2,
inout float4 img_color : COLOR
) {
VS_QuadProj(v, p, uv1, uv2);
}
// Pixel shader functions (for changing the grab pass texture).
float4 blur_x(float2 img_uv, float4 grab_uv, sampler2D grab_tex) {
float2 dir = float2(ps.x * _Size, 0.0);
float4 blur = linear_blur(grab_tex, grab_uv, dir);
blur.a = 1.0;
float4 color = tex2D(_MainTex, img_uv);
return blur * color.a;
}
float4 blur_y(float2 img_uv, float4 grab_uv, float4 img_color, sampler2D grab_tex) {
float2 dir = float2(0.0, ps.y * _Size);
float4 blur = linear_blur(grab_tex, grab_uv, dir);
blur.a = 1.0;
float4 color = tex2D(_MainTex, img_uv) * img_color;
color = lerp(blur * color.a, color, _Opacity);
return color;
}
#endif

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 96a99edaa0ac6da4a96a077b4d91df2c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,85 @@
%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: UIBlur
m_Shader: {fileID: 4800000, guid: 96680bfa9c0aec143a67a3dcf5bc0cca, 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:
- _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}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Opacity: 0.446
- _Parallax: 0.02
- _Size: 1
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _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}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c1452457ae3ea9649bb4557ad5128a71
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,81 @@
/*
Simple box blur shader for UI elements, blurring the background.
This variant uses independent grab passes to avoid glitches that occur when
elements touch viewport borders.
This also means it will work with multiple blurry widgets set on top of each
other.
*/
Shader "UI/Blur" {
Properties {
[HideInInspector]
_MainTex("", 2D) = "" {}
_Opacity("Opacity", Range(0.0, 1.0)) = 0.5
_Size("Size", Range(1.0, 16.0)) = 4.0
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
}
Cull Off
ZTest [unity_GUIZTestMode]
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
CGINCLUDE
#include "UIBlur.cginc"
sampler2D _GrabTexture;
float4 PS_BlurX(
float4 p : SV_POSITION,
float2 uv1 : TEXCOORD0,
float4 uv2 : TEXCOORD1
) : SV_TARGET {
return blur_x(uv1, uv2, _GrabTexture);
}
float4 PS_BlurY(
float4 p : SV_POSITION,
float2 uv1 : TEXCOORD0,
float4 uv2 : TEXCOORD1,
float4 img_color : COLOR
) : SV_TARGET {
return blur_y(uv1, uv2, img_color, _GrabTexture);
}
ENDCG
GrabPass {
Tags {
"LightMode" = "Always"
}
}
Pass {
CGPROGRAM
#pragma vertex VS_QuadProj
#pragma fragment PS_BlurX
ENDCG
}
GrabPass {
Tags {
"LightMode" = "Always"
}
}
Pass {
CGPROGRAM
#pragma vertex VS_QuadProjColor
#pragma fragment PS_BlurY
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 96680bfa9c0aec143a67a3dcf5bc0cca
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,83 @@
/*
Simple box blur shader for UI elements, blurring the background.
This variant uses shared textures for faster grab passes. This means all
blurry widgets will share the same effect/texture/blur, so you won't be able
to layer them on top of each other and still achieve the same effect.
Use the "UI/Blur" variant if you need that, but be aware it may be slower.
*/
Shader "UI/BlurFast" {
Properties {
[HideInInspector]
_MainTex("", 2D) = "" {}
_Opacity("Opacity", Range(0.0, 1.0)) = 0.5
_Size("Size", Range(1.0, 16.0)) = 4.0
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
}
Cull Off
ZTest [unity_GUIZTestMode]
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
CGINCLUDE
#include "UIBlur.cginc"
sampler2D _UIBlurXTex, _UIBlurYTex;
float4 PS_BlurX(
float4 p : SV_POSITION,
float2 uv1 : TEXCOORD0,
float4 uv2 : TEXCOORD1
) : SV_TARGET {
return blur_x(uv1, uv2, _UIBlurXTex);
}
float4 PS_BlurY(
float4 p : SV_POSITION,
float2 uv1 : TEXCOORD0,
float4 uv2 : TEXCOORD1,
float4 img_color : COLOR
) : SV_TARGET {
return blur_y(uv1, uv2, img_color, _UIBlurYTex);
}
ENDCG
GrabPass {
"_UIBlurXTex"
Tags {
"LightMode" = "Always"
}
}
Pass {
CGPROGRAM
#pragma vertex VS_QuadProj
#pragma fragment PS_BlurX
ENDCG
}
GrabPass {
"_UIBlurYTex"
Tags {
"LightMode" = "Always"
}
}
Pass {
CGPROGRAM
#pragma vertex VS_QuadProjColor
#pragma fragment PS_BlurY
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1e49512045b19ea43aa6379ab4fb957b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant: