UI update 02

This commit is contained in:
FloatGaming
2026-06-30 21:21:30 +08:00
parent b2a1e307a4
commit f62f643cfc
1666 changed files with 211081 additions and 22799 deletions
+47
View File
@@ -0,0 +1,47 @@
%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: BansonicSpriteGlow 1
m_Shader: {fileID: 4800000, guid: 2aac54fa2fa410f428fc64b31dbeaea0, 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:
- _AlphaTex:
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}
m_Ints: []
m_Floats:
- PixelSnap: 0
- _AlphaClip: 0.001
- _EnableExternalAlpha: 0
- _GlowRadius: 0
- _Intensity: 0.0245
- _Threshold: 0.08
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 2.0026178, g: 2.0026178, b: 2.0026178, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9e1d4e4bd2dab83469a86dc28fad4035
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
+47
View File
@@ -0,0 +1,47 @@
%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: BansonicSpriteGlow
m_Shader: {fileID: 4800000, guid: 2aac54fa2fa410f428fc64b31dbeaea0, 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:
- _AlphaTex:
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}
m_Ints: []
m_Floats:
- PixelSnap: 0
- _AlphaClip: 0.001
- _EnableExternalAlpha: 0
- _GlowRadius: 0
- _Intensity: 0.0245
- _Threshold: 0.08
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 2.0026178, g: 2.0026178, b: 2.0026178, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9027023882919794db87137efb11ab4b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
+274
View File
@@ -0,0 +1,274 @@
Shader "Bansonic/Sprite Glow"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
[HideInInspector] _Color ("Tint", Color) = (1,1,1,1)
[HideInInspector] PixelSnap ("Pixel snap", Float) = 0
[HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1)
[HideInInspector] _AlphaTex ("External Alpha", 2D) = "white" {}
[HideInInspector] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
[HDR]_GlowColor ("Glow Color", Color) = (1,1,1,1)
_Threshold ("Glow Threshold", Range(0, 4)) = 0.9
_Intensity ("Glow Intensity", Range(0, 8)) = 1.5
_GlowRadius ("Glow Radius", Range(0, 32)) = 6
}
SubShader
{
Tags
{
"Queue" = "Transparent"
"RenderType" = "Transparent"
"RenderPipeline" = "UniversalPipeline"
"CanUseSpriteAtlas" = "True"
}
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
Cull Off
ZWrite Off
Pass
{
Tags { "LightMode" = "Universal2D" }
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
#pragma vertex SpriteVertex
#pragma fragment SpriteFragment
#pragma target 2.0
#pragma multi_compile_instancing
#pragma multi_compile _ SKINNED_SPRITE
struct Attributes
{
float3 positionOS : POSITION;
float4 color : COLOR;
float2 uv : TEXCOORD0;
UNITY_SKINNED_VERTEX_INPUTS
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
half4 color : COLOR;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
float4 _MainTex_TexelSize;
CBUFFER_START(UnityPerMaterial)
half4 _Color;
half4 _GlowColor;
half _Threshold;
half _Intensity;
half _GlowRadius;
CBUFFER_END
Varyings SpriteVertex(Attributes input)
{
Varyings output = (Varyings)0;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
UNITY_SKINNED_VERTEX_COMPUTE(input);
SetUpSpriteInstanceProperties();
input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy);
output.positionCS = TransformObjectToHClip(input.positionOS);
output.uv = input.uv;
output.color = input.color * _Color * unity_SpriteColor;
return output;
}
half GetLuminance(half3 color)
{
return dot(color, half3(0.2126h, 0.7152h, 0.0722h));
}
half SampleGlowMask(float2 uv, half4 tint)
{
half4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv) * tint;
half luminance = GetLuminance(tex.rgb);
half mask = smoothstep(_Threshold - 0.18h, _Threshold + 0.18h, luminance);
return mask * tex.a;
}
half ComputeGlow(float2 uv, half4 tint)
{
float2 texel = _MainTex_TexelSize.xy * max(_GlowRadius, 0.001h) * 1.5;
const half w0 = 0.180h;
const half w1 = 0.150h;
const half w2 = 0.120h;
const half w3 = 0.090h;
const half w4 = 0.060h;
half sum = SampleGlowMask(uv, tint) * w0;
sum += SampleGlowMask(uv + texel * float2( 0.65, 0.00), tint) * w1;
sum += SampleGlowMask(uv + texel * float2(-0.65, 0.00), tint) * w1;
sum += SampleGlowMask(uv + texel * float2( 0.00, 0.65), tint) * w1;
sum += SampleGlowMask(uv + texel * float2( 0.00, -0.65), tint) * w1;
sum += SampleGlowMask(uv + texel * float2( 0.50, 0.50), tint) * w2;
sum += SampleGlowMask(uv + texel * float2(-0.50, 0.50), tint) * w2;
sum += SampleGlowMask(uv + texel * float2( 0.50, -0.50), tint) * w2;
sum += SampleGlowMask(uv + texel * float2(-0.50, -0.50), tint) * w2;
sum += SampleGlowMask(uv + texel * float2( 1.35, 0.00), tint) * w3;
sum += SampleGlowMask(uv + texel * float2(-1.35, 0.00), tint) * w3;
sum += SampleGlowMask(uv + texel * float2( 0.00, 1.35), tint) * w3;
sum += SampleGlowMask(uv + texel * float2( 0.00, -1.35), tint) * w3;
sum += SampleGlowMask(uv + texel * float2( 1.00, 1.00), tint) * w4;
sum += SampleGlowMask(uv + texel * float2(-1.00, 1.00), tint) * w4;
sum += SampleGlowMask(uv + texel * float2( 1.00, -1.00), tint) * w4;
sum += SampleGlowMask(uv + texel * float2(-1.00, -1.00), tint) * w4;
return sum;
}
half4 SpriteFragment(Varyings input) : SV_Target
{
half4 baseSample = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv) * input.color;
half glowStrength = ComputeGlow(input.uv, input.color) * _Intensity * 1.75h;
half3 glow = _GlowColor.rgb * glowStrength * _GlowColor.a;
half4 color = baseSample;
color.rgb += glow;
color.a = saturate(baseSample.a + glowStrength * 0.55h);
return color;
}
ENDHLSL
}
Pass
{
Tags { "LightMode" = "UniversalForward" }
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
#pragma vertex SpriteVertex
#pragma fragment SpriteFragment
#pragma target 2.0
#pragma multi_compile_instancing
#pragma multi_compile _ SKINNED_SPRITE
struct Attributes
{
float3 positionOS : POSITION;
float4 color : COLOR;
float2 uv : TEXCOORD0;
UNITY_SKINNED_VERTEX_INPUTS
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
half4 color : COLOR;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
float4 _MainTex_TexelSize;
CBUFFER_START(UnityPerMaterial)
half4 _Color;
half4 _GlowColor;
half _Threshold;
half _Intensity;
half _GlowRadius;
CBUFFER_END
Varyings SpriteVertex(Attributes input)
{
Varyings output = (Varyings)0;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
UNITY_SKINNED_VERTEX_COMPUTE(input);
SetUpSpriteInstanceProperties();
input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy);
output.positionCS = TransformObjectToHClip(input.positionOS);
output.uv = input.uv;
output.color = input.color * _Color * unity_SpriteColor;
return output;
}
half GetLuminance(half3 color)
{
return dot(color, half3(0.2126h, 0.7152h, 0.0722h));
}
half SampleGlowMask(float2 uv, half4 tint)
{
half4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv) * tint;
half luminance = GetLuminance(tex.rgb);
half mask = smoothstep(_Threshold - 0.18h, _Threshold + 0.18h, luminance);
return mask * tex.a;
}
half ComputeGlow(float2 uv, half4 tint)
{
float2 texel = _MainTex_TexelSize.xy * max(_GlowRadius, 0.001h) * 1.5;
const half w0 = 0.180h;
const half w1 = 0.150h;
const half w2 = 0.120h;
const half w3 = 0.090h;
const half w4 = 0.060h;
half sum = SampleGlowMask(uv, tint) * w0;
sum += SampleGlowMask(uv + texel * float2( 0.65, 0.00), tint) * w1;
sum += SampleGlowMask(uv + texel * float2(-0.65, 0.00), tint) * w1;
sum += SampleGlowMask(uv + texel * float2( 0.00, 0.65), tint) * w1;
sum += SampleGlowMask(uv + texel * float2( 0.00, -0.65), tint) * w1;
sum += SampleGlowMask(uv + texel * float2( 0.50, 0.50), tint) * w2;
sum += SampleGlowMask(uv + texel * float2(-0.50, 0.50), tint) * w2;
sum += SampleGlowMask(uv + texel * float2( 0.50, -0.50), tint) * w2;
sum += SampleGlowMask(uv + texel * float2(-0.50, -0.50), tint) * w2;
sum += SampleGlowMask(uv + texel * float2( 1.35, 0.00), tint) * w3;
sum += SampleGlowMask(uv + texel * float2(-1.35, 0.00), tint) * w3;
sum += SampleGlowMask(uv + texel * float2( 0.00, 1.35), tint) * w3;
sum += SampleGlowMask(uv + texel * float2( 0.00, -1.35), tint) * w3;
sum += SampleGlowMask(uv + texel * float2( 1.00, 1.00), tint) * w4;
sum += SampleGlowMask(uv + texel * float2(-1.00, 1.00), tint) * w4;
sum += SampleGlowMask(uv + texel * float2( 1.00, -1.00), tint) * w4;
sum += SampleGlowMask(uv + texel * float2(-1.00, -1.00), tint) * w4;
return sum;
}
half4 SpriteFragment(Varyings input) : SV_Target
{
half4 baseSample = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv) * input.color;
half glowStrength = ComputeGlow(input.uv, input.color) * _Intensity * 1.75h;
half3 glow = _GlowColor.rgb * glowStrength * _GlowColor.a;
half4 color = baseSample;
color.rgb += glow;
color.a = saturate(baseSample.a + glowStrength * 0.55h);
return color;
}
ENDHLSL
}
}
FallBack "Universal Render Pipeline/2D/Sprite-Unlit-Default"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2aac54fa2fa410f428fc64b31dbeaea0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,199 @@
Shader "UI/Bansonic/Blur Behind"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_BlurRadius ("Blur Radius", Range(0,4)) = 1.2
_BlurSpread ("Blur Spread", Range(0.25,3)) = 1
_BackgroundOpacity ("Background Opacity", Range(0,1)) = 1
_TintStrength ("Tint Strength", Range(0,1)) = 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]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
Comp [_StencilComp]
Pass [_StencilOp]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend One OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
Name "Default"
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#ifndef fixed
#define fixed half
#endif
#ifndef fixed2
#define fixed2 half2
#endif
#ifndef fixed3
#define fixed3 half3
#endif
#ifndef fixed4
#define fixed4 half4
#endif
#include "UnityUI.cginc"
#pragma multi_compile_local _ UNITY_UI_CLIP_RECT
#pragma multi_compile_local _ UNITY_UI_ALPHACLIP
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
float4 mask : TEXCOORD2;
float4 screenPosition : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
TEXTURE2D_X(_BansonicUIBlurSourceTex);
SAMPLER(sampler_BansonicUIBlurSourceTex);
fixed4 _Color;
fixed4 _TextureSampleAdd;
float4 _ClipRect;
float4 _MainTex_ST;
float4 _BansonicUIBlurSourceTex_TexelSize;
float _UIMaskSoftnessX;
float _UIMaskSoftnessY;
float _BlurRadius;
float _BlurSpread;
float _BackgroundOpacity;
float _TintStrength;
v2f vert(appdata_t v)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.worldPosition = v.vertex;
OUT.vertex = TransformObjectToHClip(v.vertex.xyz);
OUT.screenPosition = OUT.vertex;
OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
float2 pixelSize = OUT.vertex.w;
pixelSize /= float2(1, 1) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
OUT.mask = float4(
v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw,
0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy))
);
OUT.color = v.color * _Color;
return OUT;
}
half4 SampleBlurredBackground(float2 screenUV, float blurRadius)
{
screenUV = UnityStereoTransformScreenSpaceTex(screenUV);
screenUV = saturate(screenUV);
float2 texel = _BansonicUIBlurSourceTex_TexelSize.xy * blurRadius * _BlurSpread;
float2 clampMin = _BansonicUIBlurSourceTex_TexelSize.xy * 0.5;
float2 clampMax = 1.0 - clampMin;
#define SAMPLE_BG(uv) SAMPLE_TEXTURE2D_X(_BansonicUIBlurSourceTex, sampler_BansonicUIBlurSourceTex, clamp((uv), clampMin, clampMax))
half4 sum = SAMPLE_BG(screenUV) * 4.0h;
sum += SAMPLE_BG(screenUV + float2( texel.x, 0)) * 2.0h;
sum += SAMPLE_BG(screenUV + float2(-texel.x, 0)) * 2.0h;
sum += SAMPLE_BG(screenUV + float2(0, texel.y)) * 2.0h;
sum += SAMPLE_BG(screenUV + float2(0, -texel.y)) * 2.0h;
sum += SAMPLE_BG(screenUV + float2( texel.x, texel.y));
sum += SAMPLE_BG(screenUV + float2(-texel.x, texel.y));
sum += SAMPLE_BG(screenUV + float2( texel.x, -texel.y));
sum += SAMPLE_BG(screenUV + float2(-texel.x, -texel.y));
float2 texel2 = texel * 2.0;
sum += SAMPLE_BG(screenUV + float2( texel2.x, 0));
sum += SAMPLE_BG(screenUV + float2(-texel2.x, 0));
sum += SAMPLE_BG(screenUV + float2(0, texel2.y));
sum += SAMPLE_BG(screenUV + float2(0, -texel2.y));
#undef SAMPLE_BG
return sum / 20.0h;
}
fixed4 frag(v2f IN) : SV_Target
{
const half alphaPrecision = half(0xff);
const half invAlphaPrecision = half(1.0 / alphaPrecision);
IN.color.a = round(IN.color.a * alphaPrecision) * invAlphaPrecision;
fixed4 spriteSample = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
float2 screenUV = GetNormalizedScreenSpaceUV(IN.vertex);
half4 blurred = SampleBlurredBackground(screenUV, max(_BlurRadius, 0.0001));
half3 tint = lerp(half3(1, 1, 1), saturate(spriteSample.rgb), _TintStrength);
half4 color;
color.rgb = blurred.rgb * tint;
color.a = spriteSample.a * _BackgroundOpacity;
#ifdef UNITY_UI_CLIP_RECT
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw);
color.a *= m.x * m.y;
#endif
#ifdef UNITY_UI_ALPHACLIP
clip(color.a - 0.001);
#endif
color.rgb *= color.a;
return color;
}
ENDHLSL
}
}
Fallback Off
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9d7f0b51d62b4f5b8aa1d4c9342f7f1a
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -158,7 +158,7 @@ Shader "UI/Soft Shadow"
fixed4 src = SampleSprite(contentUv, IN.color);
float shadowAlpha = SampleShadowAlpha(contentUv, IN.color.a) * _ShadowColor.a;
fixed3 shadowRgb = _ShadowColor.rgb * shadowAlpha;
fixed3 shadowRgb = _ShadowColor.rgb * shadowAlpha;
fixed4 col;
col.a = src.a + shadowAlpha * (1.0 - src.a);