modified maps
modified maps
This commit is contained in:
@ -0,0 +1,116 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/Blend" {
|
||||
Properties {
|
||||
_MainTex ("Screen Blended", 2D) = "" {}
|
||||
_ColorBuffer ("Color", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv[2] : TEXCOORD0;
|
||||
};
|
||||
struct v2f_mt {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv[4] : TEXCOORD0;
|
||||
};
|
||||
|
||||
sampler2D _ColorBuffer;
|
||||
sampler2D _MainTex;
|
||||
|
||||
half _Intensity;
|
||||
half4 _ColorBuffer_TexelSize;
|
||||
half4 _MainTex_TexelSize;
|
||||
|
||||
v2f vert( appdata_img v ) {
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv[0] = v.texcoord.xy;
|
||||
o.uv[1] = v.texcoord.xy;
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
if (_ColorBuffer_TexelSize.y < 0)
|
||||
o.uv[1].y = 1-o.uv[1].y;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_mt vertMultiTap( appdata_img v ) {
|
||||
v2f_mt o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv[0] = v.texcoord.xy + _MainTex_TexelSize.xy * 0.5;
|
||||
o.uv[1] = v.texcoord.xy - _MainTex_TexelSize.xy * 0.5;
|
||||
o.uv[2] = v.texcoord.xy - _MainTex_TexelSize.xy * half2(1,-1) * 0.5;
|
||||
o.uv[3] = v.texcoord.xy + _MainTex_TexelSize.xy * half2(1,-1) * 0.5;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 fragScreen (v2f i) : SV_Target {
|
||||
half4 toBlend = saturate (tex2D(_MainTex, i.uv[0]) * _Intensity);
|
||||
return 1-(1-toBlend)*(1-tex2D(_ColorBuffer, i.uv[1]));
|
||||
}
|
||||
|
||||
half4 fragAdd (v2f i) : SV_Target {
|
||||
return tex2D(_MainTex, i.uv[0].xy) * _Intensity + tex2D(_ColorBuffer, i.uv[1]);
|
||||
}
|
||||
|
||||
half4 fragVignetteBlend (v2f i) : SV_Target {
|
||||
return tex2D(_MainTex, i.uv[0].xy) * tex2D(_ColorBuffer, i.uv[0]);
|
||||
}
|
||||
|
||||
half4 fragMultiTap (v2f_mt i) : SV_Target {
|
||||
half4 outColor = tex2D(_MainTex, i.uv[0].xy);
|
||||
outColor += tex2D(_MainTex, i.uv[1].xy);
|
||||
outColor += tex2D(_MainTex, i.uv[2].xy);
|
||||
outColor += tex2D(_MainTex, i.uv[3].xy);
|
||||
return outColor * 0.25;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
// 0: nicer & softer "screen" blend mode
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragScreen
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 1: simple "add" blend mode
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragAdd
|
||||
ENDCG
|
||||
}
|
||||
// 2: used for "stable" downsampling
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertMultiTap
|
||||
#pragma fragment fragMultiTap
|
||||
ENDCG
|
||||
}
|
||||
// 3: vignette blending
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragVignetteBlend
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
} // shader
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53b3960ee3d3d4a5caa8d5473d120187
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,222 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/BlendForBloom" {
|
||||
Properties {
|
||||
_MainTex ("Screen Blended", 2D) = "" {}
|
||||
_ColorBuffer ("Color", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv[2] : TEXCOORD0;
|
||||
};
|
||||
struct v2f_mt {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv[5] : TEXCOORD0;
|
||||
};
|
||||
|
||||
sampler2D _ColorBuffer;
|
||||
sampler2D _MainTex;
|
||||
|
||||
half _Intensity;
|
||||
half4 _ColorBuffer_TexelSize;
|
||||
half4 _MainTex_TexelSize;
|
||||
|
||||
v2f vert( appdata_img v ) {
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv[0] = v.texcoord.xy;
|
||||
o.uv[1] = v.texcoord.xy;
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
if (_ColorBuffer_TexelSize.y < 0)
|
||||
o.uv[1].y = 1-o.uv[1].y;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_mt vertMultiTap( appdata_img v ) {
|
||||
v2f_mt o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv[4] = v.texcoord.xy;
|
||||
o.uv[0] = v.texcoord.xy + _MainTex_TexelSize.xy * 0.5;
|
||||
o.uv[1] = v.texcoord.xy - _MainTex_TexelSize.xy * 0.5;
|
||||
o.uv[2] = v.texcoord.xy - _MainTex_TexelSize.xy * half2(1,-1) * 0.5;
|
||||
o.uv[3] = v.texcoord.xy + _MainTex_TexelSize.xy * half2(1,-1) * 0.5;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 fragScreen (v2f i) : SV_Target {
|
||||
half4 addedbloom = tex2D(_MainTex, i.uv[0].xy) * _Intensity;
|
||||
half4 screencolor = tex2D(_ColorBuffer, i.uv[1]);
|
||||
return 1-(1-addedbloom)*(1-screencolor);
|
||||
}
|
||||
|
||||
half4 fragScreenCheap(v2f i) : SV_Target {
|
||||
half4 addedbloom = tex2D(_MainTex, i.uv[0].xy) * _Intensity;
|
||||
half4 screencolor = tex2D(_ColorBuffer, i.uv[1]);
|
||||
return 1-(1-addedbloom)*(1-screencolor);
|
||||
}
|
||||
|
||||
half4 fragAdd (v2f i) : SV_Target {
|
||||
half4 addedbloom = tex2D(_MainTex, i.uv[0].xy);
|
||||
half4 screencolor = tex2D(_ColorBuffer, i.uv[1]);
|
||||
return _Intensity * addedbloom + screencolor;
|
||||
}
|
||||
|
||||
half4 fragAddCheap (v2f i) : SV_Target {
|
||||
half4 addedbloom = tex2D(_MainTex, i.uv[0].xy);
|
||||
half4 screencolor = tex2D(_ColorBuffer, i.uv[1]);
|
||||
return _Intensity * addedbloom + screencolor;
|
||||
}
|
||||
|
||||
half4 fragVignetteMul (v2f i) : SV_Target {
|
||||
return tex2D(_MainTex, i.uv[0].xy) * tex2D(_ColorBuffer, i.uv[0]);
|
||||
}
|
||||
|
||||
half4 fragVignetteBlend (v2f i) : SV_Target {
|
||||
return half4(1,1,1, tex2D(_ColorBuffer, i.uv[0]).r);
|
||||
}
|
||||
|
||||
half4 fragClear (v2f i) : SV_Target {
|
||||
return 0;
|
||||
}
|
||||
|
||||
half4 fragAddOneOne (v2f i) : SV_Target {
|
||||
half4 addedColors = tex2D(_MainTex, i.uv[0].xy);
|
||||
return addedColors * _Intensity;
|
||||
}
|
||||
|
||||
half4 frag1Tap (v2f i) : SV_Target {
|
||||
return tex2D(_MainTex, i.uv[0].xy);
|
||||
}
|
||||
|
||||
half4 fragMultiTapMax (v2f_mt i) : SV_Target {
|
||||
half4 outColor = tex2D(_MainTex, i.uv[4].xy);
|
||||
outColor = max(outColor, tex2D(_MainTex, i.uv[0].xy));
|
||||
outColor = max(outColor, tex2D(_MainTex, i.uv[1].xy));
|
||||
outColor = max(outColor, tex2D(_MainTex, i.uv[2].xy));
|
||||
outColor = max(outColor, tex2D(_MainTex, i.uv[3].xy));
|
||||
return outColor;
|
||||
}
|
||||
|
||||
half4 fragMultiTapBlur (v2f_mt i) : SV_Target {
|
||||
half4 outColor = 0;
|
||||
outColor += tex2D(_MainTex, i.uv[0].xy);
|
||||
outColor += tex2D(_MainTex, i.uv[1].xy);
|
||||
outColor += tex2D(_MainTex, i.uv[2].xy);
|
||||
outColor += tex2D(_MainTex, i.uv[3].xy);
|
||||
return outColor/4;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
// 0: nicer & softer "screen" blend mode
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragScreen
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 1: "add" blend mode
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragAdd
|
||||
ENDCG
|
||||
}
|
||||
// 2: several taps, maxxed
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertMultiTap
|
||||
#pragma fragment fragMultiTapMax
|
||||
ENDCG
|
||||
}
|
||||
// 3: vignette blending
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragVignetteMul
|
||||
ENDCG
|
||||
}
|
||||
// 4: nicer & softer "screen" blend mode(cheapest)
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragScreenCheap
|
||||
ENDCG
|
||||
}
|
||||
// 5: "add" blend mode (cheapest)
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragAddCheap
|
||||
ENDCG
|
||||
}
|
||||
// 6: used for "stable" downsampling (blur)
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertMultiTap
|
||||
#pragma fragment fragMultiTapBlur
|
||||
ENDCG
|
||||
}
|
||||
// 7: vignette blending (blend to dest)
|
||||
Pass {
|
||||
|
||||
Blend Zero SrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragVignetteBlend
|
||||
ENDCG
|
||||
}
|
||||
// 8: clear
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragClear
|
||||
ENDCG
|
||||
}
|
||||
// 9: fragAddOneOne
|
||||
Pass {
|
||||
|
||||
Blend One One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragAddOneOne
|
||||
ENDCG
|
||||
}
|
||||
// 10: max blend
|
||||
Pass {
|
||||
|
||||
BlendOp Max
|
||||
Blend One One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag1Tap
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
} // shader
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7856cbff0a0ca45c787d5431eb805bb0
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,50 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/BlendOneOne" {
|
||||
Properties {
|
||||
_MainTex ("-", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
half _Intensity;
|
||||
|
||||
v2f vert( appdata_img v ) {
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) : SV_Target {
|
||||
return tex2D(_MainTex, i.uv) * _Intensity;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader {
|
||||
|
||||
Pass {
|
||||
BlendOp Add
|
||||
Blend One One
|
||||
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7898d203e9b94c0dbe2bf9dd5cb32c0
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,204 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/BlurAndFlares" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "" {}
|
||||
_NonBlurredTex ("Base (RGB)", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
half4 pos : SV_POSITION;
|
||||
half2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f_opts {
|
||||
half4 pos : SV_POSITION;
|
||||
half2 uv[7] : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f_blur {
|
||||
half4 pos : SV_POSITION;
|
||||
half2 uv : TEXCOORD0;
|
||||
half4 uv01 : TEXCOORD1;
|
||||
half4 uv23 : TEXCOORD2;
|
||||
half4 uv45 : TEXCOORD3;
|
||||
half4 uv67 : TEXCOORD4;
|
||||
};
|
||||
|
||||
half4 _Offsets;
|
||||
half4 _TintColor;
|
||||
|
||||
half _StretchWidth;
|
||||
half2 _Threshhold;
|
||||
half _Saturation;
|
||||
|
||||
half4 _MainTex_TexelSize;
|
||||
|
||||
sampler2D _MainTex;
|
||||
sampler2D _NonBlurredTex;
|
||||
|
||||
v2f vert (appdata_img v) {
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_blur vertWithMultiCoords2 (appdata_img v) {
|
||||
v2f_blur o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv.xy = v.texcoord.xy;
|
||||
o.uv01 = v.texcoord.xyxy + _Offsets.xyxy * half4(1,1, -1,-1);
|
||||
o.uv23 = v.texcoord.xyxy + _Offsets.xyxy * half4(1,1, -1,-1) * 2.0;
|
||||
o.uv45 = v.texcoord.xyxy + _Offsets.xyxy * half4(1,1, -1,-1) * 3.0;
|
||||
o.uv67 = v.texcoord.xyxy + _Offsets.xyxy * half4(1,1, -1,-1) * 4.0;
|
||||
o.uv67 = v.texcoord.xyxy + _Offsets.xyxy * half4(1,1, -1,-1) * 5.0;
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_opts vertStretch (appdata_img v) {
|
||||
v2f_opts o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
half b = _StretchWidth;
|
||||
o.uv[0] = v.texcoord.xy;
|
||||
o.uv[1] = v.texcoord.xy + b * 2.0 * _Offsets.xy;
|
||||
o.uv[2] = v.texcoord.xy - b * 2.0 * _Offsets.xy;
|
||||
o.uv[3] = v.texcoord.xy + b * 4.0 * _Offsets.xy;
|
||||
o.uv[4] = v.texcoord.xy - b * 4.0 * _Offsets.xy;
|
||||
o.uv[5] = v.texcoord.xy + b * 6.0 * _Offsets.xy;
|
||||
o.uv[6] = v.texcoord.xy - b * 6.0 * _Offsets.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_opts vertWithMultiCoords (appdata_img v) {
|
||||
v2f_opts o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv[0] = v.texcoord.xy;
|
||||
o.uv[1] = v.texcoord.xy + 0.5 * _MainTex_TexelSize.xy * _Offsets.xy;
|
||||
o.uv[2] = v.texcoord.xy - 0.5 * _MainTex_TexelSize.xy * _Offsets.xy;
|
||||
o.uv[3] = v.texcoord.xy + 1.5 * _MainTex_TexelSize.xy * _Offsets.xy;
|
||||
o.uv[4] = v.texcoord.xy - 1.5 * _MainTex_TexelSize.xy * _Offsets.xy;
|
||||
o.uv[5] = v.texcoord.xy + 2.5 * _MainTex_TexelSize.xy * _Offsets.xy;
|
||||
o.uv[6] = v.texcoord.xy - 2.5 * _MainTex_TexelSize.xy * _Offsets.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 fragPostNoBlur (v2f i) : SV_Target {
|
||||
half4 color = tex2D (_MainTex, i.uv);
|
||||
return color * 1.0/(1.0 + Luminance(color.rgb) + 0.5); // this also makes it a little noisy
|
||||
}
|
||||
|
||||
half4 fragGaussBlur (v2f_blur i) : SV_Target {
|
||||
half4 color = half4 (0,0,0,0);
|
||||
color += 0.225 * tex2D (_MainTex, i.uv);
|
||||
color += 0.150 * tex2D (_MainTex, i.uv01.xy);
|
||||
color += 0.150 * tex2D (_MainTex, i.uv01.zw);
|
||||
color += 0.110 * tex2D (_MainTex, i.uv23.xy);
|
||||
color += 0.110 * tex2D (_MainTex, i.uv23.zw);
|
||||
color += 0.075 * tex2D (_MainTex, i.uv45.xy);
|
||||
color += 0.075 * tex2D (_MainTex, i.uv45.zw);
|
||||
color += 0.0525 * tex2D (_MainTex, i.uv67.xy);
|
||||
color += 0.0525 * tex2D (_MainTex, i.uv67.zw);
|
||||
return color;
|
||||
}
|
||||
|
||||
half4 fragPreAndCut (v2f_opts i) : SV_Target {
|
||||
half4 color = tex2D (_MainTex, i.uv[0]);
|
||||
color += tex2D (_MainTex, i.uv[1]);
|
||||
color += tex2D (_MainTex, i.uv[2]);
|
||||
color += tex2D (_MainTex, i.uv[3]);
|
||||
color += tex2D (_MainTex, i.uv[4]);
|
||||
color += tex2D (_MainTex, i.uv[5]);
|
||||
color += tex2D (_MainTex, i.uv[6]);
|
||||
color = max(color / 7.0 - _Threshhold.xxxx, float4(0,0,0,0));
|
||||
half lum = Luminance(color.rgb);
|
||||
color.rgb = lerp(half3(lum,lum,lum), color.rgb, _Saturation) * _TintColor.rgb;
|
||||
return color;
|
||||
}
|
||||
|
||||
half4 fragStretch (v2f_opts i) : SV_Target {
|
||||
half4 color = tex2D (_MainTex, i.uv[0]);
|
||||
color = max (color, tex2D (_MainTex, i.uv[1]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[2]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[3]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[4]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[5]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[6]));
|
||||
return color;
|
||||
}
|
||||
|
||||
half4 fragPost (v2f_opts i) : SV_Target {
|
||||
half4 color = tex2D (_MainTex, i.uv[0]);
|
||||
color += tex2D (_MainTex, i.uv[1]);
|
||||
color += tex2D (_MainTex, i.uv[2]);
|
||||
color += tex2D (_MainTex, i.uv[3]);
|
||||
color += tex2D (_MainTex, i.uv[4]);
|
||||
color += tex2D (_MainTex, i.uv[5]);
|
||||
color += tex2D (_MainTex, i.uv[6]);
|
||||
return color * 1.0/(7.0 + Luminance(color.rgb) + 0.5); // this also makes it a little noisy
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragPostNoBlur
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertStretch
|
||||
#pragma fragment fragStretch
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 2
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertWithMultiCoords
|
||||
#pragma fragment fragPreAndCut
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 3
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertWithMultiCoords
|
||||
#pragma fragment fragPost
|
||||
|
||||
ENDCG
|
||||
}
|
||||
// 4
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertWithMultiCoords2
|
||||
#pragma fragment fragGaussBlur
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be6e39cf196f146d5be72fbefb18ed75
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,59 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/BrightPassFilterForBloom"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGB)", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
half4 threshold;
|
||||
half useSrcAlphaAsMask;
|
||||
|
||||
v2f vert( appdata_img v )
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) : SV_Target
|
||||
{
|
||||
half4 color = tex2D(_MainTex, i.uv);
|
||||
//color = color * saturate((color-threshhold.x) * 75.0); // didn't go well with HDR and din't make sense
|
||||
color = color * lerp(1.0, color.a, useSrcAlphaAsMask);
|
||||
color = max(half4(0,0,0,0), color-threshold.x);
|
||||
return color;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback off
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 186c4c0d31e314f049595dcbaf4ca129
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,76 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/BrightPassFilter2"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGB)", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
half4 _Threshhold;
|
||||
|
||||
v2f vert( appdata_img v )
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 fragScalarThresh(v2f i) : SV_Target
|
||||
{
|
||||
half4 color = tex2D(_MainTex, i.uv);
|
||||
color.rgb = color.rgb;
|
||||
color.rgb = max(half3(0,0,0), color.rgb-_Threshhold.xxx);
|
||||
return color;
|
||||
}
|
||||
|
||||
half4 fragColorThresh(v2f i) : SV_Target
|
||||
{
|
||||
half4 color = tex2D(_MainTex, i.uv);
|
||||
color.rgb = max(half3(0,0,0), color.rgb-_Threshhold.rgb);
|
||||
return color;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragScalarThresh
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragColorThresh
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback off
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0aeaa4cb29f5d4e9c8455f04c8575c8c
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,62 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/LensFlareCreate" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv[4] : TEXCOORD0;
|
||||
};
|
||||
|
||||
fixed4 colorA;
|
||||
fixed4 colorB;
|
||||
fixed4 colorC;
|
||||
fixed4 colorD;
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
v2f vert( appdata_img v ) {
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
o.uv[0] = ( ( v.texcoord.xy - 0.5 ) * -0.85 ) + 0.5;
|
||||
o.uv[1] = ( ( v.texcoord.xy - 0.5 ) * -1.45 ) + 0.5;
|
||||
o.uv[2] = ( ( v.texcoord.xy - 0.5 ) * -2.55 ) + 0.5;
|
||||
o.uv[3] = ( ( v.texcoord.xy - 0.5 ) * -4.15 ) + 0.5;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 color = float4 (0,0,0,0);
|
||||
color += tex2D(_MainTex, i.uv[0] ) * colorA;
|
||||
color += tex2D(_MainTex, i.uv[1] ) * colorB;
|
||||
color += tex2D(_MainTex, i.uv[2] ) * colorC;
|
||||
color += tex2D(_MainTex, i.uv[3] ) * colorD;
|
||||
return color;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader {
|
||||
Blend One One
|
||||
Pass {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
} // shader
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 459fe69d2f6d74ddb92f04dbf45a866b
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,294 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
|
||||
Shader "Hidden/FastBloom" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_Bloom ("Bloom (RGB)", 2D) = "black" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
sampler2D _Bloom;
|
||||
|
||||
uniform half4 _MainTex_TexelSize;
|
||||
|
||||
uniform half4 _Parameter;
|
||||
uniform half4 _OffsetsA;
|
||||
uniform half4 _OffsetsB;
|
||||
|
||||
#define ONE_MINUS_THRESHHOLD_TIMES_INTENSITY _Parameter.w
|
||||
#define THRESHHOLD _Parameter.z
|
||||
|
||||
struct v2f_simple
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half2 uv : TEXCOORD0;
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
half2 uv2 : TEXCOORD1;
|
||||
#endif
|
||||
};
|
||||
|
||||
v2f_simple vertBloom ( appdata_img v )
|
||||
{
|
||||
v2f_simple o;
|
||||
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
o.uv = v.texcoord;
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
o.uv2 = v.texcoord;
|
||||
if (_MainTex_TexelSize.y < 0.0)
|
||||
o.uv.y = 1.0 - o.uv.y;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
struct v2f_tap
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half2 uv20 : TEXCOORD0;
|
||||
half2 uv21 : TEXCOORD1;
|
||||
half2 uv22 : TEXCOORD2;
|
||||
half2 uv23 : TEXCOORD3;
|
||||
};
|
||||
|
||||
v2f_tap vert4Tap ( appdata_img v )
|
||||
{
|
||||
v2f_tap o;
|
||||
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
o.uv20 = v.texcoord + _MainTex_TexelSize.xy;
|
||||
o.uv21 = v.texcoord + _MainTex_TexelSize.xy * half2(-0.5h,-0.5h);
|
||||
o.uv22 = v.texcoord + _MainTex_TexelSize.xy * half2(0.5h,-0.5h);
|
||||
o.uv23 = v.texcoord + _MainTex_TexelSize.xy * half2(-0.5h,0.5h);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 fragBloom ( v2f_simple i ) : SV_Target
|
||||
{
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
|
||||
fixed4 color = tex2D(_MainTex, i.uv2);
|
||||
return color + tex2D(_Bloom, i.uv);
|
||||
|
||||
#else
|
||||
|
||||
fixed4 color = tex2D(_MainTex, i.uv);
|
||||
return color + tex2D(_Bloom, i.uv);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
fixed4 fragDownsample ( v2f_tap i ) : SV_Target
|
||||
{
|
||||
fixed4 color = tex2D (_MainTex, i.uv20);
|
||||
color += tex2D (_MainTex, i.uv21);
|
||||
color += tex2D (_MainTex, i.uv22);
|
||||
color += tex2D (_MainTex, i.uv23);
|
||||
return max(color/4 - THRESHHOLD, 0) * ONE_MINUS_THRESHHOLD_TIMES_INTENSITY;
|
||||
}
|
||||
|
||||
// weight curves
|
||||
|
||||
static const half curve[7] = { 0.0205, 0.0855, 0.232, 0.324, 0.232, 0.0855, 0.0205 }; // gauss'ish blur weights
|
||||
|
||||
static const half4 curve4[7] = { half4(0.0205,0.0205,0.0205,0), half4(0.0855,0.0855,0.0855,0), half4(0.232,0.232,0.232,0),
|
||||
half4(0.324,0.324,0.324,1), half4(0.232,0.232,0.232,0), half4(0.0855,0.0855,0.0855,0), half4(0.0205,0.0205,0.0205,0) };
|
||||
|
||||
struct v2f_withBlurCoords8
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half4 uv : TEXCOORD0;
|
||||
half2 offs : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct v2f_withBlurCoordsSGX
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half2 uv : TEXCOORD0;
|
||||
half4 offs[3] : TEXCOORD1;
|
||||
};
|
||||
|
||||
v2f_withBlurCoords8 vertBlurHorizontal (appdata_img v)
|
||||
{
|
||||
v2f_withBlurCoords8 o;
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
|
||||
o.uv = half4(v.texcoord.xy,1,1);
|
||||
o.offs = _MainTex_TexelSize.xy * half2(1.0, 0.0) * _Parameter.x;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_withBlurCoords8 vertBlurVertical (appdata_img v)
|
||||
{
|
||||
v2f_withBlurCoords8 o;
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
|
||||
o.uv = half4(v.texcoord.xy,1,1);
|
||||
o.offs = _MainTex_TexelSize.xy * half2(0.0, 1.0) * _Parameter.x;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 fragBlur8 ( v2f_withBlurCoords8 i ) : SV_Target
|
||||
{
|
||||
half2 uv = i.uv.xy;
|
||||
half2 netFilterWidth = i.offs;
|
||||
half2 coords = uv - netFilterWidth * 3.0;
|
||||
|
||||
half4 color = 0;
|
||||
for( int l = 0; l < 7; l++ )
|
||||
{
|
||||
half4 tap = tex2D(_MainTex, coords);
|
||||
color += tap * curve4[l];
|
||||
coords += netFilterWidth;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
v2f_withBlurCoordsSGX vertBlurHorizontalSGX (appdata_img v)
|
||||
{
|
||||
v2f_withBlurCoordsSGX o;
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
|
||||
o.uv = v.texcoord.xy;
|
||||
half2 netFilterWidth = _MainTex_TexelSize.xy * half2(1.0, 0.0) * _Parameter.x;
|
||||
half4 coords = -netFilterWidth.xyxy * 3.0;
|
||||
|
||||
o.offs[0] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
coords += netFilterWidth.xyxy;
|
||||
o.offs[1] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
coords += netFilterWidth.xyxy;
|
||||
o.offs[2] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_withBlurCoordsSGX vertBlurVerticalSGX (appdata_img v)
|
||||
{
|
||||
v2f_withBlurCoordsSGX o;
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
|
||||
o.uv = half4(v.texcoord.xy,1,1);
|
||||
half2 netFilterWidth = _MainTex_TexelSize.xy * half2(0.0, 1.0) * _Parameter.x;
|
||||
half4 coords = -netFilterWidth.xyxy * 3.0;
|
||||
|
||||
o.offs[0] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
coords += netFilterWidth.xyxy;
|
||||
o.offs[1] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
coords += netFilterWidth.xyxy;
|
||||
o.offs[2] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 fragBlurSGX ( v2f_withBlurCoordsSGX i ) : SV_Target
|
||||
{
|
||||
half2 uv = i.uv.xy;
|
||||
|
||||
half4 color = tex2D(_MainTex, i.uv) * curve4[3];
|
||||
|
||||
for( int l = 0; l < 3; l++ )
|
||||
{
|
||||
half4 tapA = tex2D(_MainTex, i.offs[l].xy);
|
||||
half4 tapB = tex2D(_MainTex, i.offs[l].zw);
|
||||
color += (tapA + tapB) * curve4[l];
|
||||
}
|
||||
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
SubShader {
|
||||
ZTest Off Cull Off ZWrite Off Blend Off
|
||||
|
||||
// 0
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vertBloom
|
||||
#pragma fragment fragBloom
|
||||
|
||||
ENDCG
|
||||
|
||||
}
|
||||
|
||||
// 1
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert4Tap
|
||||
#pragma fragment fragDownsample
|
||||
|
||||
ENDCG
|
||||
|
||||
}
|
||||
|
||||
// 2
|
||||
Pass {
|
||||
ZTest Always
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertBlurVertical
|
||||
#pragma fragment fragBlur8
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 3
|
||||
Pass {
|
||||
ZTest Always
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertBlurHorizontal
|
||||
#pragma fragment fragBlur8
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// alternate blur
|
||||
// 4
|
||||
Pass {
|
||||
ZTest Always
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertBlurVerticalSGX
|
||||
#pragma fragment fragBlurSGX
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 5
|
||||
Pass {
|
||||
ZTest Always
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertBlurHorizontalSGX
|
||||
#pragma fragment fragBlurSGX
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
FallBack Off
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68a00c837b82e4c6d92e7da765dc5f1d
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,236 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
|
||||
Shader "Hidden/FastBlur" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_Bloom ("Bloom (RGB)", 2D) = "black" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
sampler2D _Bloom;
|
||||
|
||||
uniform half4 _MainTex_TexelSize;
|
||||
uniform half4 _Parameter;
|
||||
|
||||
struct v2f_tap
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half2 uv20 : TEXCOORD0;
|
||||
half2 uv21 : TEXCOORD1;
|
||||
half2 uv22 : TEXCOORD2;
|
||||
half2 uv23 : TEXCOORD3;
|
||||
};
|
||||
|
||||
v2f_tap vert4Tap ( appdata_img v )
|
||||
{
|
||||
v2f_tap o;
|
||||
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
o.uv20 = v.texcoord + _MainTex_TexelSize.xy;
|
||||
o.uv21 = v.texcoord + _MainTex_TexelSize.xy * half2(-0.5h,-0.5h);
|
||||
o.uv22 = v.texcoord + _MainTex_TexelSize.xy * half2(0.5h,-0.5h);
|
||||
o.uv23 = v.texcoord + _MainTex_TexelSize.xy * half2(-0.5h,0.5h);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 fragDownsample ( v2f_tap i ) : SV_Target
|
||||
{
|
||||
fixed4 color = tex2D (_MainTex, i.uv20);
|
||||
color += tex2D (_MainTex, i.uv21);
|
||||
color += tex2D (_MainTex, i.uv22);
|
||||
color += tex2D (_MainTex, i.uv23);
|
||||
return color / 4;
|
||||
}
|
||||
|
||||
// weight curves
|
||||
|
||||
static const half curve[7] = { 0.0205, 0.0855, 0.232, 0.324, 0.232, 0.0855, 0.0205 }; // gauss'ish blur weights
|
||||
|
||||
static const half4 curve4[7] = { half4(0.0205,0.0205,0.0205,0), half4(0.0855,0.0855,0.0855,0), half4(0.232,0.232,0.232,0),
|
||||
half4(0.324,0.324,0.324,1), half4(0.232,0.232,0.232,0), half4(0.0855,0.0855,0.0855,0), half4(0.0205,0.0205,0.0205,0) };
|
||||
|
||||
struct v2f_withBlurCoords8
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half4 uv : TEXCOORD0;
|
||||
half2 offs : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct v2f_withBlurCoordsSGX
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half2 uv : TEXCOORD0;
|
||||
half4 offs[3] : TEXCOORD1;
|
||||
};
|
||||
|
||||
v2f_withBlurCoords8 vertBlurHorizontal (appdata_img v)
|
||||
{
|
||||
v2f_withBlurCoords8 o;
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
|
||||
o.uv = half4(v.texcoord.xy,1,1);
|
||||
o.offs = _MainTex_TexelSize.xy * half2(1.0, 0.0) * _Parameter.x;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_withBlurCoords8 vertBlurVertical (appdata_img v)
|
||||
{
|
||||
v2f_withBlurCoords8 o;
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
|
||||
o.uv = half4(v.texcoord.xy,1,1);
|
||||
o.offs = _MainTex_TexelSize.xy * half2(0.0, 1.0) * _Parameter.x;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 fragBlur8 ( v2f_withBlurCoords8 i ) : SV_Target
|
||||
{
|
||||
half2 uv = i.uv.xy;
|
||||
half2 netFilterWidth = i.offs;
|
||||
half2 coords = uv - netFilterWidth * 3.0;
|
||||
|
||||
half4 color = 0;
|
||||
for( int l = 0; l < 7; l++ )
|
||||
{
|
||||
half4 tap = tex2D(_MainTex, coords);
|
||||
color += tap * curve4[l];
|
||||
coords += netFilterWidth;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
v2f_withBlurCoordsSGX vertBlurHorizontalSGX (appdata_img v)
|
||||
{
|
||||
v2f_withBlurCoordsSGX o;
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
|
||||
o.uv = v.texcoord.xy;
|
||||
half2 netFilterWidth = _MainTex_TexelSize.xy * half2(1.0, 0.0) * _Parameter.x;
|
||||
half4 coords = -netFilterWidth.xyxy * 3.0;
|
||||
|
||||
o.offs[0] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
coords += netFilterWidth.xyxy;
|
||||
o.offs[1] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
coords += netFilterWidth.xyxy;
|
||||
o.offs[2] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_withBlurCoordsSGX vertBlurVerticalSGX (appdata_img v)
|
||||
{
|
||||
v2f_withBlurCoordsSGX o;
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
|
||||
o.uv = half4(v.texcoord.xy,1,1);
|
||||
half2 netFilterWidth = _MainTex_TexelSize.xy * half2(0.0, 1.0) * _Parameter.x;
|
||||
half4 coords = -netFilterWidth.xyxy * 3.0;
|
||||
|
||||
o.offs[0] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
coords += netFilterWidth.xyxy;
|
||||
o.offs[1] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
coords += netFilterWidth.xyxy;
|
||||
o.offs[2] = v.texcoord.xyxy + coords * half4(1.0h,1.0h,-1.0h,-1.0h);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 fragBlurSGX ( v2f_withBlurCoordsSGX i ) : SV_Target
|
||||
{
|
||||
half2 uv = i.uv.xy;
|
||||
|
||||
half4 color = tex2D(_MainTex, i.uv) * curve4[3];
|
||||
|
||||
for( int l = 0; l < 3; l++ )
|
||||
{
|
||||
half4 tapA = tex2D(_MainTex, i.offs[l].xy);
|
||||
half4 tapB = tex2D(_MainTex, i.offs[l].zw);
|
||||
color += (tapA + tapB) * curve4[l];
|
||||
}
|
||||
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
SubShader {
|
||||
ZTest Off Cull Off ZWrite Off Blend Off
|
||||
|
||||
// 0
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert4Tap
|
||||
#pragma fragment fragDownsample
|
||||
|
||||
ENDCG
|
||||
|
||||
}
|
||||
|
||||
// 1
|
||||
Pass {
|
||||
ZTest Always
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertBlurVertical
|
||||
#pragma fragment fragBlur8
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 2
|
||||
Pass {
|
||||
ZTest Always
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertBlurHorizontal
|
||||
#pragma fragment fragBlur8
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// alternate blur
|
||||
// 3
|
||||
Pass {
|
||||
ZTest Always
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertBlurVerticalSGX
|
||||
#pragma fragment fragBlurSGX
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 4
|
||||
Pass {
|
||||
ZTest Always
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertBlurHorizontalSGX
|
||||
#pragma fragment fragBlurSGX
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
FallBack Off
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9d5fa183cd6b45eeb1491f74863cd91
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,156 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/MultipassHollywoodFlares" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "" {}
|
||||
_NonBlurredTex ("Base (RGB)", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
half4 pos : SV_POSITION;
|
||||
half2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f_opts {
|
||||
half4 pos : SV_POSITION;
|
||||
half2 uv[7] : TEXCOORD0;
|
||||
};
|
||||
|
||||
half4 offsets;
|
||||
half4 tintColor;
|
||||
|
||||
half stretchWidth;
|
||||
half2 _Threshhold;
|
||||
|
||||
half4 _MainTex_TexelSize;
|
||||
|
||||
sampler2D _MainTex;
|
||||
sampler2D _NonBlurredTex;
|
||||
|
||||
v2f vert (appdata_img v) {
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.texcoord.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_opts vertStretch (appdata_img v) {
|
||||
v2f_opts o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
half b = stretchWidth;
|
||||
o.uv[0] = v.texcoord.xy;
|
||||
o.uv[1] = v.texcoord.xy + b * 2.0 * offsets.xy;
|
||||
o.uv[2] = v.texcoord.xy - b * 2.0 * offsets.xy;
|
||||
o.uv[3] = v.texcoord.xy + b * 4.0 * offsets.xy;
|
||||
o.uv[4] = v.texcoord.xy - b * 4.0 * offsets.xy;
|
||||
o.uv[5] = v.texcoord.xy + b * 6.0 * offsets.xy;
|
||||
o.uv[6] = v.texcoord.xy - b * 6.0 * offsets.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
v2f_opts vertVerticalCoords (appdata_img v) {
|
||||
v2f_opts o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv[0] = v.texcoord.xy;
|
||||
o.uv[1] = v.texcoord.xy + 0.5 * _MainTex_TexelSize.xy * half2(0,1);
|
||||
o.uv[2] = v.texcoord.xy - 0.5 * _MainTex_TexelSize.xy * half2(0,1);
|
||||
o.uv[3] = v.texcoord.xy + 1.5 * _MainTex_TexelSize.xy * half2(0,1);
|
||||
o.uv[4] = v.texcoord.xy - 1.5 * _MainTex_TexelSize.xy * half2(0,1);
|
||||
o.uv[5] = v.texcoord.xy + 2.5 * _MainTex_TexelSize.xy * half2(0,1);
|
||||
o.uv[6] = v.texcoord.xy - 2.5 * _MainTex_TexelSize.xy * half2(0,1);
|
||||
return o;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
half4 fragPrepare (v2f i) : SV_Target {
|
||||
half4 color = tex2D (_MainTex, i.uv);
|
||||
half4 colorNb = tex2D (_NonBlurredTex, i.uv);
|
||||
return color * tintColor * 0.5 + colorNb * normalize (tintColor) * 0.5;
|
||||
}
|
||||
|
||||
|
||||
half4 fragPreAndCut (v2f_opts i) : SV_Target {
|
||||
half4 color = tex2D (_MainTex, i.uv[0]);
|
||||
color += tex2D (_MainTex, i.uv[1]);
|
||||
color += tex2D (_MainTex, i.uv[2]);
|
||||
color += tex2D (_MainTex, i.uv[3]);
|
||||
color += tex2D (_MainTex, i.uv[4]);
|
||||
color += tex2D (_MainTex, i.uv[5]);
|
||||
color += tex2D (_MainTex, i.uv[6]);
|
||||
return max(color / 7.0 - _Threshhold.x, 0.0) * _Threshhold.y * tintColor;
|
||||
}
|
||||
|
||||
half4 fragStretch (v2f_opts i) : SV_Target {
|
||||
half4 color = tex2D (_MainTex, i.uv[0]);
|
||||
color = max (color, tex2D (_MainTex, i.uv[1]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[2]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[3]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[4]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[5]));
|
||||
color = max (color, tex2D (_MainTex, i.uv[6]));
|
||||
return color;
|
||||
}
|
||||
|
||||
half4 fragPost (v2f_opts i) : SV_Target {
|
||||
half4 color = tex2D (_MainTex, i.uv[0]);
|
||||
color += tex2D (_MainTex, i.uv[1]);
|
||||
color += tex2D (_MainTex, i.uv[2]);
|
||||
color += tex2D (_MainTex, i.uv[3]);
|
||||
color += tex2D (_MainTex, i.uv[4]);
|
||||
color += tex2D (_MainTex, i.uv[5]);
|
||||
color += tex2D (_MainTex, i.uv[6]);
|
||||
return color * 1.0/(7.0 + Luminance(color.rgb) + 0.5); // this also makes it a little noisy
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragPrepare
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertStretch
|
||||
#pragma fragment fragStretch
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertVerticalCoords
|
||||
#pragma fragment fragPreAndCut
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vertVerticalCoords
|
||||
#pragma fragment fragPost
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2baf3cae8edc4daf94c9adc2154be00
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,71 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/SeparableBlurPlus" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
half4 pos : SV_POSITION;
|
||||
half2 uv : TEXCOORD0;
|
||||
half4 uv01 : TEXCOORD1;
|
||||
half4 uv23 : TEXCOORD2;
|
||||
half4 uv45 : TEXCOORD3;
|
||||
half4 uv67 : TEXCOORD4;
|
||||
};
|
||||
|
||||
half4 offsets;
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
v2f vert (appdata_img v) {
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
o.uv.xy = v.texcoord.xy;
|
||||
|
||||
o.uv01 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1);
|
||||
o.uv23 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1) * 2.0;
|
||||
o.uv45 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1) * 3.0;
|
||||
o.uv67 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1) * 4.5;
|
||||
o.uv67 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1) * 6.5;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (v2f i) : SV_Target {
|
||||
half4 color = half4 (0,0,0,0);
|
||||
|
||||
color += 0.225 * tex2D (_MainTex, i.uv);
|
||||
color += 0.150 * tex2D (_MainTex, i.uv01.xy);
|
||||
color += 0.150 * tex2D (_MainTex, i.uv01.zw);
|
||||
color += 0.110 * tex2D (_MainTex, i.uv23.xy);
|
||||
color += 0.110 * tex2D (_MainTex, i.uv23.zw);
|
||||
color += 0.075 * tex2D (_MainTex, i.uv45.xy);
|
||||
color += 0.075 * tex2D (_MainTex, i.uv45.zw);
|
||||
color += 0.0525 * tex2D (_MainTex, i.uv67.xy);
|
||||
color += 0.0525 * tex2D (_MainTex, i.uv67.zw);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader {
|
||||
Pass {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
} // shader
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9df009a214e24a5ebbf271595f8d5b6
|
||||
ShaderImporter:
|
||||
userData:
|
@ -0,0 +1,59 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Hidden/VignetteShader" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
float4 _MainTex_TexelSize;
|
||||
float vignetteIntensity;
|
||||
|
||||
v2f vert( appdata_img v ) {
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
o.uv = v.texcoord.xy;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) : SV_Target {
|
||||
half2 coords = i.uv;
|
||||
half2 uv = i.uv;
|
||||
|
||||
coords = (coords - 0.5) * 2.0;
|
||||
half coordDot = dot (coords,coords);
|
||||
half4 color = tex2D (_MainTex, uv);
|
||||
|
||||
float mask = 1.0 - coordDot * vignetteIntensity;
|
||||
return color * mask;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Subshader {
|
||||
Pass {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
} // shader
|
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 562f620336e024ac99992ff05725a89a
|
||||
ShaderImporter:
|
||||
userData:
|
Reference in New Issue
Block a user