shader fixes
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
Shader "QO/Sprite Add"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGBA)", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_UVWH ("UVWH", Vector) = (0,0,1,1)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
LOD 200
|
||||
|
||||
Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
|
||||
Pass {
|
||||
Blend SrcAlpha One
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
half4 _Color;
|
||||
float4 _UVWH;
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
float2 uv_2 = _UVWH.xy;
|
||||
float2 wh_1 = _UVWH.zw;
|
||||
o.color = v.color;
|
||||
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
o.texcoord = ((v.texcoord * wh_1) + uv_2);
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (v2f IN) : COLOR
|
||||
{
|
||||
float4 tex = tex2D(_MainTex, IN.texcoord);
|
||||
float4 tmpvar_1 = (tex * _Color);
|
||||
return tmpvar_1;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
Shader "QO/Sprite Back"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGBA)", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_UVWH ("UVWH", Vector) = (0,0,1,1)
|
||||
}
|
||||
|
||||
SubShader {
|
||||
LOD 200
|
||||
Tags { "QUEUE"="Background" "RenderType"="Background" }
|
||||
Pass {
|
||||
ZTest Always
|
||||
Cull Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
half4 _Color;
|
||||
float4 _UVWH;
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
float2 uv_2 = _UVWH.xy;
|
||||
float2 wh_1 = _UVWH.zw;
|
||||
o.color = v.color;
|
||||
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
o.texcoord = ((v.texcoord * wh_1) + uv_2);
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (v2f IN) : COLOR
|
||||
{
|
||||
float4 tex = tex2D(_MainTex, IN.texcoord);
|
||||
float4 tmpvar_1 = (tex * _Color);
|
||||
return tmpvar_1;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
Shader "QO/Sprite Flash"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGBA)", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_EffectColor ("EffectColor", Color) = (1,1,1,1)
|
||||
_UVWH ("UVWH", Vector) = (0,0,1,1)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
LOD 200
|
||||
|
||||
Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
|
||||
Pass {
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
half4 _Color;
|
||||
half4 _EffectColor;
|
||||
float4 _UVWH;
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
float2 uv_2 = _UVWH.xy;
|
||||
float2 wh_1 = _UVWH.zw;
|
||||
o.color = v.color;
|
||||
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
o.texcoord = ((v.texcoord * wh_1) + uv_2);
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (v2f IN) : COLOR
|
||||
{
|
||||
float4 tex = tex2D(_MainTex, IN.texcoord);
|
||||
float4 src_1 = (tex * _Color);
|
||||
float3 tmpvar_4 = lerp(_EffectColor.xyz, src_1.xyz, _EffectColor.www);
|
||||
float4 final = (tmpvar_4.x,tmpvar_4.y,tmpvar_4.z,src_1.w);
|
||||
return final;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
Shader "QO/Sprite NoTexAlpha"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGBA)", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_UVWH ("UVWH", Vector) = (0,0,1,1)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
LOD 200
|
||||
|
||||
Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
|
||||
Pass {
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
half4 _Color;
|
||||
float4 _UVWH;
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
float2 uv_2 = _UVWH.xy;
|
||||
float2 wh_1 = _UVWH.zw;
|
||||
o.color = v.color;
|
||||
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
o.texcoord = ((v.texcoord * wh_1) + uv_2);
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (v2f IN) : COLOR
|
||||
{
|
||||
float3 rest = tex2D(_MainTex, IN.texcoord).xyz;
|
||||
float4 together = (rest.x,rest.y, rest.z, 0.0);
|
||||
//float4 tex = tex2D(_MainTex, IN.texcoord);
|
||||
float4 tmpvar_1 = (together * _Color);
|
||||
return tmpvar_1;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
Shader "QO/Sprite Sub" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGBA)", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_UVWH ("UVWH", Vector) = (0,0,1,1)
|
||||
}
|
||||
SubShader {
|
||||
LOD 200
|
||||
Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
|
||||
Pass {
|
||||
Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
|
||||
Blend SrcAlpha One
|
||||
BlendOp RevSub
|
||||
Program "vp" {
|
||||
SubProgram "gles " {
|
||||
"!!GLES
|
||||
|
||||
|
||||
#ifdef VERTEX
|
||||
|
||||
varying lowp vec2 xlv_TEXCOORD0;
|
||||
uniform highp vec4 _UVWH;
|
||||
uniform highp mat4 glstate_matrix_mvp;
|
||||
attribute vec4 _glesMultiTexCoord0;
|
||||
attribute vec4 _glesVertex;
|
||||
void main ()
|
||||
{
|
||||
lowp vec2 wh_1;
|
||||
lowp vec2 uv_2;
|
||||
lowp vec2 tmpvar_3;
|
||||
highp vec2 tmpvar_4;
|
||||
tmpvar_4 = _UVWH.xy;
|
||||
uv_2 = tmpvar_4;
|
||||
highp vec2 tmpvar_5;
|
||||
tmpvar_5 = _UVWH.zw;
|
||||
wh_1 = tmpvar_5;
|
||||
highp vec2 tmpvar_6;
|
||||
tmpvar_6 = ((_glesMultiTexCoord0.xy * wh_1) + uv_2);
|
||||
tmpvar_3 = tmpvar_6;
|
||||
gl_Position = (glstate_matrix_mvp * _glesVertex);
|
||||
xlv_TEXCOORD0 = tmpvar_3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#ifdef FRAGMENT
|
||||
|
||||
varying lowp vec2 xlv_TEXCOORD0;
|
||||
uniform highp vec4 _Color;
|
||||
uniform sampler2D _MainTex;
|
||||
void main ()
|
||||
{
|
||||
mediump vec4 tmpvar_1;
|
||||
mediump vec4 texcol_2;
|
||||
lowp vec4 tmpvar_3;
|
||||
tmpvar_3 = texture2D (_MainTex, xlv_TEXCOORD0);
|
||||
texcol_2 = tmpvar_3;
|
||||
tmpvar_1 = (texcol_2 * _Color);
|
||||
gl_FragData[0] = tmpvar_1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif"
|
||||
}
|
||||
}
|
||||
Program "fp" {
|
||||
SubProgram "gles " {
|
||||
"!!GLES"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Fallback "Diffuse"
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
Shader "QO/Sprite"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGBA)", 2D) = "white" {}
|
||||
_Color ("Color", Color) = (1,1,1,1)
|
||||
_UVWH ("UVWH", Vector) = (0,0,1,1)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
LOD 200
|
||||
|
||||
Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
|
||||
Pass {
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
half4 _Color;
|
||||
float4 _UVWH;
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
float2 uv_2 = _UVWH.xy;
|
||||
float2 wh_1 = _UVWH.zw;
|
||||
o.color = v.color;
|
||||
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
o.texcoord = ((v.texcoord * wh_1) + uv_2);
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (v2f IN) : COLOR
|
||||
{
|
||||
float4 tex = tex2D(_MainTex, IN.texcoord);
|
||||
float4 tmpvar_1 = (tex * _Color);
|
||||
return tmpvar_1;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
Shader "QO/TextSprite"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
LOD 200
|
||||
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Transparent"
|
||||
"IgnoreProjector" = "True"
|
||||
"RenderType" = "Transparent"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Offset -1, -1
|
||||
Fog { Mode Off }
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
half4 _MainTex_ST;
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
o.color = v.color;
|
||||
o.texcoord = v.texcoord;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag (v2f IN) : COLOR
|
||||
{
|
||||
half4 mask = tex2D(_MainTex, IN.texcoord);
|
||||
half4 mixed = saturate(ceil(IN.color - 0.5));
|
||||
half4 col = saturate((mixed * 0.51 - IN.color) / -0.49);
|
||||
|
||||
mask *= mixed;
|
||||
col.a *= mask.r + mask.g + mask.b + mask.a;
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
Reference in New Issue
Block a user