You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
1.6 KiB
84 lines
1.6 KiB
3 years ago
|
Shader "Mine/fogTest_2"
|
||
|
{
|
||
|
Properties
|
||
|
{
|
||
|
_MainTex ("Texture", 2D) = "white" {}
|
||
|
_AlphaScale("AlphaScale",Range(0,1)) = 1
|
||
|
_Color("ColorMain",Color) = (1,1,1,1)
|
||
|
_Value1("Value1",Float) = 0
|
||
|
_Value2("Value2",Float) = 0
|
||
|
_Value3("Value3",Range(0,1)) = 1
|
||
|
|
||
|
}
|
||
|
SubShader
|
||
|
{
|
||
|
Tags { "RenderType"="Transparent"
|
||
|
"Queue"="Transparent"
|
||
|
"IgnoreProjector"="True" }
|
||
|
LOD 100
|
||
|
Pass
|
||
|
{
|
||
|
ZWrite On
|
||
|
ColorMask 0
|
||
|
}
|
||
|
Pass
|
||
|
{
|
||
|
ZWrite off
|
||
|
Blend SrcAlpha OneMinusSrcAlpha
|
||
|
//Blend OneMinusDstColor One
|
||
|
//Blend DstColor Zero
|
||
|
CGPROGRAM
|
||
|
#pragma vertex vert
|
||
|
#pragma fragment frag
|
||
|
// make fog work
|
||
|
#pragma multi_compile_fog
|
||
|
|
||
|
#include "UnityCG.cginc"
|
||
|
|
||
|
struct appdata
|
||
|
{
|
||
|
float4 vertex : POSITION;
|
||
|
float2 uv : TEXCOORD0;
|
||
|
float4 tangent :TANGENT;
|
||
|
};
|
||
|
|
||
|
struct v2f
|
||
|
{
|
||
|
float2 uv : TEXCOORD0;
|
||
|
UNITY_FOG_COORDS(1)
|
||
|
float4 vertex : SV_POSITION;
|
||
|
fixed4 color :COLOR;
|
||
|
};
|
||
|
|
||
|
sampler2D _MainTex;
|
||
|
float4 _MainTex_ST;
|
||
|
fixed _AlphaScale;
|
||
|
fixed4 _Color;
|
||
|
float _Value1;
|
||
|
float _Value2;
|
||
|
float _Value3;
|
||
|
|
||
|
v2f vert (appdata v)
|
||
|
{
|
||
|
v2f o;
|
||
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||
|
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||
|
o.color = _Color*sin(v.vertex.y*_Value1+_WorldSpaceCameraPos.y-_Value2)*_Value3;
|
||
|
UNITY_TRANSFER_FOG(o,o.vertex);
|
||
|
return o;
|
||
|
}
|
||
|
|
||
|
fixed4 frag (v2f i) : SV_Target
|
||
|
{
|
||
|
// sample the texture
|
||
|
fixed4 col = tex2D(_MainTex, i.uv)*_AlphaScale*i.color;
|
||
|
// apply fog
|
||
|
UNITY_APPLY_FOG(i.fogCoord, col);
|
||
|
//col = col*_AlphaScale;
|
||
|
return col;
|
||
|
}
|
||
|
ENDCG
|
||
|
}
|
||
|
}
|
||
|
}
|