Insanely huge initial commit

This commit is contained in:
2026-02-21 16:40:15 -08:00
parent 2ba1c94b88
commit ee9aee0a1b
33825 changed files with 5213498 additions and 0 deletions

View File

@@ -0,0 +1,122 @@
Shader "Hidden/EfficientBlur"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_BackgroundColor ("_BackgroundColor", Color) = (0,0,0,0)
}
CGINCLUDE
#include "UnityCG.cginc"
#include "lib.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
float4 _MainTex_TexelSize;
uniform half _Radius;
BlurVertexOutput vert(appdata_img v)
{
BlurVertexOutput o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(BlurVertexOutput, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = GetGatherTexcoord(v.texcoord, _MainTex_TexelSize, _Radius);
return o;
}
ENDCG
SubShader
{
Cull Off ZWrite Off ZTest Always Blend Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
half4 frag(BlurVertexOutput i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i)
half4 o = GATHER(_MainTex, i.texcoord);
return o;
}
ENDCG
}
Pass
{
CGPROGRAM
//Crop before blur
#pragma vertex vertCrop
#pragma fragment frag
#pragma multi_compile_local BACKGROUND_FILL_NONE BACKGROUND_FILL_COLOR
float4 _CropRegion;
half3 _BackgroundColor;
BlurVertexOutput vertCrop(appdata_img v)
{
BlurVertexOutput o = vert(v);
o.texcoord.xy = getNewUV(o.texcoord.xy, _CropRegion);
o.texcoord.zw = getNewUV(o.texcoord.zw, _CropRegion);
return o;
}
half4 frag(BlurVertexOutput i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half4 o = GATHER(_MainTex, i.texcoord);
#if BACKGROUND_FILL_COLOR
o.rgb = lerp(_BackgroundColor, o.rgb, o.a);
o.a = 1.0h;
#endif
return o;
}
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_SETUP_INSTANCE_ID(v);
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
// o.vertex = UnityObjectToClipPos(v.vertex);
// o.uv = v.uv;
//
// o.viewDir = mul(unity_CameraInvProjection, o.vertex).xyz;
// #if UNITY_UV_STARTS_AT_TOP
// o.viewDir.y = -o.viewDir.y;
// #endif
// o.viewDir.z = -o.viewDir.z;
// o.viewDir = mul(unity_CameraToWorld, o.viewDir.xyzz).xyz;
// return o;
// }
//
// samplerCUBE _EnvTex;
// float4 _EnvTex_HDR;
//
// half4 frag(v2f i) : SV_Target
// {
// UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
// half4 col = SAMPLE_SCREEN_TEX(_MainTex, i.uv);
// half4 envData = texCUBE(_EnvTex, normalize(i.viewDir));
// half3 env = DecodeHDR(envData, _EnvTex_HDR);
// col.rgb *= col.a;
// col.rgb = col.rgb + env * (1 - col.a);
// col.a = 1;
// return col;
// }
ENDCG
}
}
FallBack Off
}

View File

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

View File

@@ -0,0 +1,59 @@
Shader "Hidden/FillCrop"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "lib.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
float4 _CropRegion;
fixed4 frag(v2f i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i)
return SAMPLE_SCREEN_TEX(_MainTex, getCroppedCoord(i.uv, _CropRegion));
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d996ab4381100014d99e25e68e9aac84
timeCreated: 1540802700
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,165 @@
Shader "UI/TranslucentImage"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Vibrancy("Vibrancy", Float) = 1
_Brightness("Brightness", Float) = 0
_Flatten("Flatten", Float) = 0
_StencilComp("Stencil Comparison", Float) = 8
_Stencil("Stencil ID", Float) = 0
_StencilOp("Stencil Operation", Float) = 0
_StencilWriteMask("Stencil Write Mask", Float) = 255
_StencilReadMask("Stencil Read Mask", Float) = 255
_ColorMask("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip("Use Alpha Clip", Float) = 0
}
SubShader
{
Tags
{
"Queue"= "Transparent"
"IgnoreProjector"= "True"
"RenderType"= "Transparent"
"PreviewType"= "Plane"
"CanUseSpriteAtlas"= "True"
}
Stencil
{
Ref[_Stencil]
Comp[_StencilComp]
Pass[_StencilOp]
ReadMask[_StencilReadMask]
WriteMask[_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest[unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask[_ColorMask]
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#include "lib.cginc"
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
struct appdata
{
half4 vertex : POSITION;
half4 color : COLOR;
half2 texcoord : TEXCOORD0;
half2 extraData : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
half4 vertex : SV_POSITION;
half4 color : COLOR;
float2 texcoord : TEXCOORD0;
half4 worldPosition : TEXCOORD1;
float4 blurTexcoord : TEXCOORD2;
half2 extraData : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
fixed4 _TextureSampleAdd;
half4 _ClipRect;
float4 _CropRegion; //xMin, yMin, xMax, yMax
v2f vert(appdata IN)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_INITIALIZE_OUTPUT(v2f, OUT);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.worldPosition = IN.vertex;
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw - 1.0)*half2(-1,1);
#endif
OUT.color = IN.color;
OUT.texcoord = IN.texcoord;
OUT.blurTexcoord = ComputeNonStereoScreenPos(OUT.vertex);
#if UNITY_VERSION >= 202120 && UNITY_UV_STARTS_AT_TOP
if(_ProjectionParams.x > 0 && unity_MatrixVP[1][1] < 0)
OUT.blurTexcoord.y = OUT.blurTexcoord.w - OUT.blurTexcoord.y;
#endif
OUT.extraData = IN.extraData;
return OUT;
}
sampler2D _MainTex;
UNITY_DECLARE_SCREENSPACE_TEXTURE(_BlurTex);
uniform half _Vibrancy;
uniform half _Flatten;
uniform half _Brightness;
half4 frag(v2f IN) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
//Overlay
half4 foregroundColor = tex2D(_MainTex, IN.texcoord.xy) + _TextureSampleAdd;
foregroundColor *= IN.color;
half2 blurTexcoord = IN.blurTexcoord.xy / IN.blurTexcoord.w;
blurTexcoord = getCroppedCoord(blurTexcoord, _CropRegion);
half3 backgroundColor = SAMPLE_SCREEN_TEX(_BlurTex, blurTexcoord).rgb;
//saturate help keep color in range
//Exclusion blend
half3 fgScaled = lerp(half3(0,0,0), foregroundColor.rgb * IN.extraData[0], _Flatten);
backgroundColor = saturate(backgroundColor + fgScaled - 2 * fgScaled * backgroundColor);
//Vibrancy
backgroundColor = saturate(lerp(LinearRgbToLuminance(backgroundColor), backgroundColor, _Vibrancy));
//Brightness
backgroundColor = saturate(backgroundColor + _Brightness);
//Alpha blend with backgroundColor
half4 color = half4(
lerp(backgroundColor, foregroundColor.rgb, IN.extraData[0]),
foregroundColor.a
);
#ifdef UNITY_UI_CLIP_RECT
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip(color.a - 0.001);
#endif
return color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b1115addd36579a429d5e6b4ffae668d
timeCreated: 1539852404
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,45 @@
#define GATHER(tex, locations) \
o = SAMPLE_SCREEN_TEX(tex, locations.xw) * 1.0h / 4.0h; \
o += SAMPLE_SCREEN_TEX(tex, locations.zw) * 1.0h / 4.0h; \
o += SAMPLE_SCREEN_TEX(tex, locations.xy) * 1.0h / 4.0h; \
o += SAMPLE_SCREEN_TEX(tex, locations.zy) * 1.0h / 4.0h; \
#if defined(UNITY_SINGLE_PASS_STEREO)
float4 StereoAdjustedTexelSize(float4 texelSize)
{
texelSize.x = texelSize.x * 2.0; // texelSize.x = 1/w. For a double-wide texture, the true resolution is given by 2/w.
texelSize.z = texelSize.z * 0.5; // texelSize.z = w. For a double-wide texture, the true size of the eye texture is given by w/2.
return texelSize;
}
#else
float4 StereoAdjustedTexelSize(float4 texelSize)
{
return texelSize;
}
#endif
float4 GetGatherTexcoord(float2 texcoord, float4 texelSize, half radius)
{
half4 offset = half2(-0.5h, 0.5h).xxyy; //-x, -y, x, y
offset *= StereoAdjustedTexelSize(texelSize).xyxy;
offset *= radius;
return texcoord.xyxy + offset;
}
float2 getNewUV(float2 oldUV, float4 cropRegion)
{
return lerp(cropRegion.xy, cropRegion.zw, oldUV);
}
float2 getCroppedCoord(float2 screenCoord, float4 cropRegion)
{
return (screenCoord - cropRegion.xy) / (cropRegion.zw - cropRegion.xy);
}
struct BlurVertexOutput
{
float4 vertex : SV_POSITION;
float4 texcoord : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};

View File

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

View File

@@ -0,0 +1,4 @@
#include <UnityCG.cginc>
#include "common.hlsl"
#define SAMPLE_SCREEN_TEX(tex, uv) UNITY_SAMPLE_SCREENSPACE_TEXTURE(tex, UnityStereoTransformScreenSpaceTex(uv))

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a8c68a14f2a58eb4eb95978229e5db5e
labels:
- TranslucentImageEditorResources
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant: