Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_AdjustColor("Adjust Color",Color)=(0,0,0,1)
}
SubShader {
Tags { "RenderType"="Opaque" }
//LOD 200
Pass{
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
ZTest Greater
CGPROGRAM
#pragma vertex vert alpha
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
uniform float4 _MainTex_ST;
float4 _AdjustColor;
float _Pow;
struct v2f {
float4 pos : POSITION;
float2 texcoord : TEXCOORD0;
};
v2f vert(appdata_base v)
{
v2f o;
float3 nm;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
return o;
}
fixed4 frag(v2f i) : COLOR
{
//return tex2D(_MainTex,i.texcoord)*fixed4(0.3,0.3,0.3,1);
//return fixed4(0.4,0.4,0.4,1);
return _AdjustColor;//fixed4(0,0.6,0,0.5);
}
ENDCG
}
Pass{
//ZWrite On
//ZTest LEqual
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
uniform float4 _MainTex_ST;
float _Pow;
struct v2f {
float4 pos : POSITION;
float2 texcoord : TEXCOORD0;
};
v2f vert(appdata_base v)
{
v2f o;
float3 nm;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
return o;
}
fixed4 frag(v2f i) : COLOR
{
return tex2D(_MainTex,i.texcoord);
}
ENDCG
}
}
FallBack "Diffuse"
}
Shader "Custom/PartDark" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_AdjustColor2("Adjust Color",Color)=(0,0,0,1)
_Pow ("Pow", Range(7.0,10.0)) = 8.0
}
SubShader {
Tags { "RenderType"="Opaque" }
//LOD 200
Pass{
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
ZTest Greater
CGPROGRAM
#pragma vertex vert alpha
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
uniform float4 _MainTex_ST;
float4 _AdjustColor2;
float _Pow;
struct v2f {
float4 pos : POSITION;
float2 texcoord : TEXCOORD0;
float amount:TEXCOORD1;
};
v2f vert(appdata_base v)
{
v2f o;
float3 nm;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
nm = mul (UNITY_MATRIX_IT_MV, float4(v.normal,0)).xyz;
nm = normalize(nm);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
o.amount = saturate((nm.x*nm.x + nm.y*nm.y - nm.z*nm.z*0.3));
o.amount =pow(o.amount,_Pow);
return o;
}
fixed4 frag(v2f i) : COLOR
{
fixed4 ret;
fixed4 f4=tex2D(_MainTex,i.texcoord);
//ret.rgb=lerp(f4.rgb,fixed3(1,0,0),i.amount)*fixed3(0.3,0.3,0.3);
//ret.rgb=fixed3(0.4,0.4,0.4);
return _AdjustColor2;//fixed4(0,0.6,0,0.5);
}
ENDCG
}
Pass{
//ZWrite On
//ZTest LEqual
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
uniform float4 _MainTex_ST;
float _Pow;
struct v2f {
float4 pos : POSITION;
float2 texcoord : TEXCOORD0;
float amount:TEXCOORD1;
};
v2f vert(appdata_base v)
{
v2f o;
float3 nm;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
nm = mul (UNITY_MATRIX_IT_MV, float4(v.normal,0)).xyz;
nm = normalize(nm);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
o.amount = saturate((nm.x*nm.x + nm.y*nm.y - nm.z*nm.z*0.3));
o.amount =pow(o.amount,_Pow);
return o;
}
fixed4 frag(v2f i) : COLOR
{
fixed4 ret;
fixed4 f4=tex2D(_MainTex,i.texcoord);
ret.rgb=lerp(f4.rgb,fixed3(0.8,0,0),i.amount);
ret.a=f4.a;
return ret;
}
ENDCG
}
}
FallBack "Diffuse"
}