Created
September 13, 2014 18:35
-
-
Save xdegtyarev/d2aeee86734f92ed965b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "xdegtyarev/InvertedFog" | |
{ | |
Properties | |
{ | |
_FogTexture ("Alpha8", 2D) = "white" {} | |
_FogIntencity("Intencity", Float) = 0.5 | |
} | |
SubShader | |
{ | |
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} | |
ZWrite Off | |
Lighting Off | |
Cull Off | |
Fog { Mode Off } | |
Blend SrcAlpha OneMinusSrcAlpha | |
Pass | |
{ | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#pragma fragmentoption ARB_precision_hint_fastest | |
#include "UnityCG.cginc" | |
sampler2D _FogTexture; | |
float4 _FogTexture_ST; | |
float _FogIntencity; | |
struct vertDataIn | |
{ | |
float4 vertex : POSITION; | |
float2 texcoord : TEXCOORD0; | |
}; | |
struct vertDataOut | |
{ | |
float4 vertex : POSITION; | |
float2 texcoord : TEXCOORD0; | |
}; | |
vertDataOut vert(vertDataIn v) | |
{ | |
vertDataOut o; | |
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); | |
o.texcoord = TRANSFORM_TEX(v.texcoord,_FogTexture); | |
return o; | |
} | |
fixed4 frag(vertDataOut i) : COLOR | |
{ | |
fixed4 col = half4(0,0,0,1) * (1 - tex2D(_FogTexture, i.texcoord).a) * _FogIntencity; | |
return col; | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment