mirror of
https://github.com/ConjureETS/MeltedBananasOJam2016.git
synced 2026-03-24 02:21:06 +00:00
Merge branch 'master' of https://github.com/ConjureETS/MeltedBananasOJam2016
This commit is contained in:
commit
0093a42bbe
89
Assets/Shaders/PostEffectShader.shader
Normal file
89
Assets/Shaders/PostEffectShader.shader
Normal file
@ -0,0 +1,89 @@
|
||||
Shader "Custom/PostEffectShader"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Blindness("Blindness", Float) = 0.6
|
||||
_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"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 position : POSITION;
|
||||
|
||||
float4 screenPos : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
|
||||
o.position = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
|
||||
o.screenPos = o.position;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
float _Blindness;
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
float2 screenPos = i.screenPos.xy / i.screenPos.w;
|
||||
float depth = _Blindness*0.0025;
|
||||
|
||||
screenPos.x = (screenPos.x + 1) * 0.5;
|
||||
|
||||
screenPos.y = 1 - (screenPos.y + 1) * 0.5;
|
||||
|
||||
half4 sum = half4(0.0h, 0.0h, 0.0h, 0.0h);
|
||||
sum += tex2D(_MainTex, float2(screenPos.x - 3.0 * depth, screenPos.y + 3.0 * depth)) * 0.09;
|
||||
sum += tex2D(_MainTex, float2(screenPos.x + 3.0 * depth, screenPos.y - 3.0 * depth)) * 0.09;
|
||||
|
||||
sum += tex2D(_MainTex, float2(screenPos.x - 2.0 * depth, screenPos.y + 2.0 * depth)) * 0.12;
|
||||
sum += tex2D(_MainTex, float2(screenPos.x + 2.0 * depth, screenPos.y - 2.0 * depth)) * 0.12;
|
||||
|
||||
sum += tex2D(_MainTex, float2(screenPos.x - 1.0 * depth, screenPos.y + 1.0 * depth)) * 0.15;
|
||||
sum += tex2D(_MainTex, float2(screenPos.x + 1.0 * depth, screenPos.y - 1.0 * depth)) * 0.15;
|
||||
|
||||
sum += tex2D(_MainTex, screenPos - 5.0 * depth) * 0.025;
|
||||
sum += tex2D(_MainTex, screenPos - 4.0 * depth) * 0.05;
|
||||
sum += tex2D(_MainTex, screenPos - 3.0 * depth) * 0.09;
|
||||
sum += tex2D(_MainTex, screenPos - 2.0 * depth) * 0.12;
|
||||
sum += tex2D(_MainTex, screenPos - 1.0 * depth) * 0.15;
|
||||
sum += tex2D(_MainTex, screenPos) * 0.16;
|
||||
sum += tex2D(_MainTex, screenPos + 5.0 * depth) * 0.15;
|
||||
sum += tex2D(_MainTex, screenPos + 4.0 * depth) * 0.12;
|
||||
sum += tex2D(_MainTex, screenPos + 3.0 * depth) * 0.09;
|
||||
sum += tex2D(_MainTex, screenPos + 2.0 * depth) * 0.05;
|
||||
sum += tex2D(_MainTex, screenPos + 1.0 * depth) * 0.025;
|
||||
|
||||
return sum / 2;
|
||||
//col.a = (c.r + c.b + c.g) / 3;
|
||||
// just invert the colors
|
||||
//col = 1 - col;
|
||||
//return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Assets/Shaders/PostEffectShader.shader.meta
Normal file
9
Assets/Shaders/PostEffectShader.shader.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8af73b3d4929e6c4bbf312b61e959c45
|
||||
timeCreated: 1466858754
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
118
Assets/Shaders/WaterBlurFinal.shader
Normal file
118
Assets/Shaders/WaterBlurFinal.shader
Normal file
@ -0,0 +1,118 @@
|
||||
Shader "Custom/WaterBlur" {
|
||||
Properties {
|
||||
_blurSizeXY("BlurSizeXY", Range(0,10)) = 0
|
||||
}
|
||||
SubShader {
|
||||
|
||||
// Draw ourselves after all opaque geometry
|
||||
Tags { "Queue" = "Transparent" }
|
||||
|
||||
// Grab the screen behind the object into _GrabTexture
|
||||
GrabPass { }
|
||||
|
||||
// Render the object with the texture generated above
|
||||
Pass {
|
||||
|
||||
|
||||
CGPROGRAM
|
||||
#pragma debug
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#ifndef SHADER_API_D3D11
|
||||
|
||||
#pragma target 3.0
|
||||
|
||||
#else
|
||||
|
||||
#pragma target 4.0
|
||||
|
||||
#endif
|
||||
|
||||
sampler2D _GrabTexture : register(s0);
|
||||
float _blurSizeXY;
|
||||
|
||||
struct data {
|
||||
|
||||
float4 vertex : POSITION;
|
||||
|
||||
float3 normal : NORMAL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct v2f {
|
||||
|
||||
float4 position : POSITION;
|
||||
|
||||
float4 screenPos : TEXCOORD0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
v2f vert(data i){
|
||||
|
||||
v2f o;
|
||||
|
||||
o.position = mul(UNITY_MATRIX_MVP, i.vertex);
|
||||
|
||||
o.screenPos = o.position;
|
||||
|
||||
return o;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
half4 frag( v2f i ) : COLOR
|
||||
|
||||
{
|
||||
|
||||
float2 screenPos = i.screenPos.xy / i.screenPos.w;
|
||||
float depth= _blurSizeXY*0.0005;
|
||||
|
||||
screenPos.x = (screenPos.x + 1) * 0.5;
|
||||
|
||||
screenPos.y = 1-(screenPos.y + 1) * 0.5;
|
||||
|
||||
half4 sum = half4(0.0h,0.0h,0.0h,0.0h);
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-5.0 * depth, screenPos.y+5.0 * depth)) * 0.025;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+5.0 * depth, screenPos.y-5.0 * depth)) * 0.025;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-4.0 * depth, screenPos.y+4.0 * depth)) * 0.05;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+4.0 * depth, screenPos.y-4.0 * depth)) * 0.05;
|
||||
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-3.0 * depth, screenPos.y+3.0 * depth)) * 0.09;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+3.0 * depth, screenPos.y-3.0 * depth)) * 0.09;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-2.0 * depth, screenPos.y+2.0 * depth)) * 0.12;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+2.0 * depth, screenPos.y-2.0 * depth)) * 0.12;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-1.0 * depth, screenPos.y+1.0 * depth)) * 0.15;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+1.0 * depth, screenPos.y-1.0 * depth)) * 0.15;
|
||||
|
||||
|
||||
|
||||
sum += tex2D( _GrabTexture, screenPos-5.0 * depth) * 0.025;
|
||||
sum += tex2D( _GrabTexture, screenPos-4.0 * depth) * 0.05;
|
||||
sum += tex2D( _GrabTexture, screenPos-3.0 * depth) * 0.09;
|
||||
sum += tex2D( _GrabTexture, screenPos-2.0 * depth) * 0.12;
|
||||
sum += tex2D( _GrabTexture, screenPos-1.0 * depth) * 0.15;
|
||||
sum += tex2D( _GrabTexture, screenPos) * 0.16;
|
||||
sum += tex2D( _GrabTexture, screenPos+5.0 * depth) * 0.15;
|
||||
sum += tex2D( _GrabTexture, screenPos+4.0 * depth) * 0.12;
|
||||
sum += tex2D( _GrabTexture, screenPos+3.0 * depth) * 0.09;
|
||||
sum += tex2D( _GrabTexture, screenPos+2.0 * depth) * 0.05;
|
||||
sum += tex2D( _GrabTexture, screenPos+1.0 * depth) * 0.025;
|
||||
|
||||
return sum/2;
|
||||
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
7
Assets/Shaders/WaterBlurFinal.shader.meta
Normal file
7
Assets/Shaders/WaterBlurFinal.shader.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eed3ece10d3b3404e8b077c5851019b9
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
194
Assets/Shaders/WaterBlurModified.shader
Normal file
194
Assets/Shaders/WaterBlurModified.shader
Normal file
@ -0,0 +1,194 @@
|
||||
Shader "Custom/WaterBlurGaussian" {
|
||||
Properties {
|
||||
_blurSizeXY("BlurSizeXY", Range(0,20)) = 0
|
||||
}
|
||||
SubShader {
|
||||
|
||||
// Draw ourselves after all opaque geometry
|
||||
Tags { "Queue" = "Transparent" }
|
||||
|
||||
// Grab the screen behind the object into _GrabTexture
|
||||
GrabPass { }
|
||||
|
||||
// Render the object with the texture generated above
|
||||
Pass {
|
||||
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#ifndef SHADER_API_D3D11
|
||||
|
||||
#pragma target 3.0
|
||||
|
||||
#else
|
||||
|
||||
#pragma target 4.0
|
||||
|
||||
#endif
|
||||
sampler2D _GrabTexture : register(s0);
|
||||
float _blurSizeXY;
|
||||
|
||||
struct data {
|
||||
|
||||
float4 vertex : POSITION;
|
||||
|
||||
float3 normal : NORMAL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct v2f {
|
||||
|
||||
float4 position : POSITION;
|
||||
|
||||
float4 screenPos : TEXCOORD0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
v2f vert(data i){
|
||||
|
||||
v2f o;
|
||||
|
||||
o.position = mul(UNITY_MATRIX_MVP, i.vertex);
|
||||
|
||||
o.screenPos = o.position;
|
||||
|
||||
|
||||
return o;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
half4 frag( v2f i ) : COLOR
|
||||
|
||||
{
|
||||
|
||||
float2 screenPos = i.screenPos.xy / i.screenPos.w;
|
||||
float depth= _blurSizeXY*0.0005;
|
||||
|
||||
screenPos.x = (screenPos.x + 1) * 0.5;
|
||||
|
||||
screenPos.y = 1-(screenPos.y + 1) * 0.5;
|
||||
|
||||
//horizontal
|
||||
|
||||
half4 sum = half4(0.0h,0.0h,0.0h,0.0h);
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-5.0 * depth, screenPos.y )) * 0.025;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+5.0 * depth, screenPos.y )) * 0.025;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-4.0 * depth, screenPos.y)) * 0.05;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+4.0 * depth, screenPos.y)) * 0.05;
|
||||
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-3.0 * depth, screenPos.y)) * 0.09;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+3.0 * depth, screenPos.y)) * 0.09;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-2.0 * depth, screenPos.y)) * 0.12;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+2.0 * depth, screenPos.y)) * 0.12;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x-1.0 * depth, screenPos.y)) * 0.15;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x+1.0 * depth, screenPos.y)) * 0.15;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y)) * 0.16;
|
||||
|
||||
return sum/2;
|
||||
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Blend One One
|
||||
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
|
||||
sampler2D _GrabTexture : register(s0);
|
||||
float _blurSizeXY;
|
||||
|
||||
struct data {
|
||||
|
||||
float4 vertex : POSITION;
|
||||
|
||||
float3 normal : NORMAL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct v2f {
|
||||
|
||||
float4 position : POSITION;
|
||||
|
||||
float4 screenPos : TEXCOORD0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
v2f vert(data i){
|
||||
|
||||
v2f o;
|
||||
|
||||
o.position = mul(UNITY_MATRIX_MVP, i.vertex);
|
||||
|
||||
o.screenPos = o.position;
|
||||
|
||||
return o;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
half4 frag( v2f i ) : COLOR
|
||||
|
||||
{
|
||||
|
||||
float2 screenPos = i.screenPos.xy / i.screenPos.w;
|
||||
float depth= _blurSizeXY*0.0005;
|
||||
|
||||
screenPos.x = (screenPos.x + 1) * 0.5;
|
||||
|
||||
screenPos.y = 1-(screenPos.y + 1) * 0.5;
|
||||
|
||||
half4 sum = half4(0.0h,0.0h,0.0h,0.0h);
|
||||
|
||||
//vertical
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y+5.0 * depth)) * 0.025;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y-5.0 * depth)) * 0.025;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y+4.0 * depth)) * 0.05;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y-4.0 * depth)) * 0.05;
|
||||
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y+3.0 * depth)) * 0.09;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y-3.0 * depth)) * 0.09;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y+2.0 * depth)) * 0.12;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y-2.0 * depth)) * 0.12;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y+1.0 * depth)) * 0.15;
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y-1.0 * depth)) * 0.15;
|
||||
|
||||
sum += tex2D( _GrabTexture, float2(screenPos.x, screenPos.y)) * 0.16;
|
||||
|
||||
|
||||
return sum/2;
|
||||
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
7
Assets/Shaders/WaterBlurModified.shader.meta
Normal file
7
Assets/Shaders/WaterBlurModified.shader.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f30c3b629e0d9c4b971df2848b5e3f3
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user