mirror of
https://github.com/imperialsushi/gutterball-3.git
synced 2025-06-15 05:07:42 +00:00
New Version 1.6
New 125 balls & powerups. Improved graphics.
This commit is contained in:
parent
b35433ae45
commit
71779ef7ac
9413 changed files with 193360 additions and 264803 deletions
|
@ -0,0 +1,70 @@
|
|||
// Calculates adaptation to minimum/maximum luminance values,
|
||||
// based on "currently adapted" and "new values to adapt to"
|
||||
// textures (both 1x1).
|
||||
|
||||
Shader "Hidden/Contrast Stretch Adaptation" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_CurTex ("Base (RGB)", 2D) = "white" {}
|
||||
}
|
||||
|
||||
Category {
|
||||
SubShader {
|
||||
Pass {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
Fog { Mode off }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform sampler2D _MainTex; // currently adapted to
|
||||
uniform sampler2D _CurTex; // new value to adapt to
|
||||
uniform float4 _AdaptParams; // x=adaptLerp, y=limitMinimum, z=limitMaximum
|
||||
|
||||
float4 frag (v2f_img i) : COLOR {
|
||||
// value is: max, min
|
||||
float2 valAdapted = tex2D(_MainTex, i.uv).xy;
|
||||
float2 valCur = tex2D(_CurTex, i.uv).xy;
|
||||
|
||||
// Calculate new adapted values: interpolate
|
||||
// from valAdapted to valCur by script-supplied amount.
|
||||
//
|
||||
// Because we store adaptation levels in a simple 8 bit/channel
|
||||
// texture, we might not have enough precision - the interpolation
|
||||
// amount might be too small to change anything, and we'll never
|
||||
// arrive at the needed values.
|
||||
//
|
||||
// So we make sure the change we do is at least 1/255th of the
|
||||
// color range - this way we'll always change the value.
|
||||
const float kMinChange = 1.0/255.0;
|
||||
float2 delta = (valCur-valAdapted) * _AdaptParams.x;
|
||||
delta.x = sign(delta.x) * max( kMinChange, abs(delta.x) );
|
||||
delta.y = sign(delta.y) * max( kMinChange, abs(delta.y) );
|
||||
|
||||
float4 valNew;
|
||||
valNew.xy = valAdapted + delta;
|
||||
|
||||
// Impose user limits on maximum/minimum values
|
||||
valNew.x = max( valNew.x, _AdaptParams.z );
|
||||
valNew.y = min( valNew.y, _AdaptParams.y );
|
||||
|
||||
// Optimization so that our final apply pass is faster:
|
||||
// z = max-min (plus a small amount to prevent division by zero)
|
||||
valNew.z = valNew.x - valNew.y + 0.01;
|
||||
// w = min/(max-min)
|
||||
valNew.w = valNew.y / valNew.z;
|
||||
|
||||
return valNew;
|
||||
}
|
||||
ENDCG
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 975d70169e1053e4980279a9170560a7
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,59 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
// Final pass in the contrast stretch effect: apply
|
||||
// color stretch to the original image, based on currently
|
||||
// adapted to minimum/maximum luminances.
|
||||
|
||||
Shader "Hidden/Contrast Stretch Apply" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_AdaptTex ("Base (RGB)", 2D) = "white" {}
|
||||
}
|
||||
|
||||
Category {
|
||||
SubShader {
|
||||
Pass {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
Fog { Mode off }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : POSITION;
|
||||
float2 uv[2] : TEXCOORD0;
|
||||
};
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform sampler2D _AdaptTex;
|
||||
|
||||
v2f vert (appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
o.uv[0] = MultiplyUV (UNITY_MATRIX_TEXTURE0, v.texcoord);
|
||||
o.uv[1] = float2(0.5,0.5);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (v2f i) : COLOR
|
||||
{
|
||||
float4 col = tex2D(_MainTex, i.uv[0]);
|
||||
float4 adapted = tex2D(_AdaptTex, i.uv[1]);
|
||||
float vmul = 1.0 / adapted.z;
|
||||
float vadd = -adapted.w;
|
||||
col.rgb = col.rgb * vmul + vadd;
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c071ccacdcec7c340a92f1e7ffb0d7ce
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,37 @@
|
|||
// Outputs luminance (grayscale) of the input image _MainTex
|
||||
|
||||
Shader "Hidden/Contrast Stretch Luminance" {
|
||||
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
}
|
||||
|
||||
Category {
|
||||
SubShader {
|
||||
Pass {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
Fog { Mode off }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
|
||||
float4 frag (v2f_img i) : COLOR
|
||||
{
|
||||
float4 col = tex2D(_MainTex, i.uv);
|
||||
col.rgb = Luminance(col.rgb) * (1+col.a*2);
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ffd2ab4c9f842bb4fa99f67fa0f7fa2c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,69 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
// Reduces input image (_MainTex) by 2x2.
|
||||
// Outputs maximum value in R, minimum in G.
|
||||
Shader "Hidden/Contrast Stretch Reduction" {
|
||||
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
}
|
||||
|
||||
Category {
|
||||
SubShader {
|
||||
Pass {
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
Fog { Mode off }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 position : POSITION;
|
||||
float2 uv[4] : TEXCOORD0;
|
||||
};
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
|
||||
v2f vert (appdata_img v) {
|
||||
v2f o;
|
||||
o.position = UnityObjectToClipPos (v.vertex);
|
||||
float2 uv = MultiplyUV (UNITY_MATRIX_TEXTURE0, v.texcoord);
|
||||
|
||||
// Compute UVs to sample 2x2 pixel block.
|
||||
o.uv[0] = uv + float2(0,0);
|
||||
o.uv[1] = uv + float2(0,1);
|
||||
o.uv[2] = uv + float2(1,0);
|
||||
o.uv[3] = uv + float2(1,1);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (v2f i) : COLOR
|
||||
{
|
||||
// Sample pixel block
|
||||
float4 v00 = tex2D(_MainTex, i.uv[0]);
|
||||
float2 v01 = tex2D(_MainTex, i.uv[1]).xy;
|
||||
float2 v10 = tex2D(_MainTex, i.uv[2]).xy;
|
||||
float2 v11 = tex2D(_MainTex, i.uv[3]).xy;
|
||||
|
||||
float4 res;
|
||||
// output x: maximum of the four values
|
||||
res.x = max( max(v00.x,v01.x), max(v10.x,v11.x) );
|
||||
// output y: minimum of the four values
|
||||
res.y = min( min(v00.y,v01.y), min(v10.y,v11.y) );
|
||||
// output zw unchanged from the first pixel
|
||||
res.zw = v00.zw;
|
||||
|
||||
return res;
|
||||
}
|
||||
ENDCG
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Fallback off
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1628c99ba3c6cfe448ac06fddc3bb224
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue