Created
January 7, 2017 08:46
-
-
Save tanyuan/59e7208166c0704c1451f756d63c3dcc to your computer and use it in GitHub Desktop.
Unity shader for inside visible transparent texture.
This file contains hidden or 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 "Unlit/UnlitTransparentTexture" | |
{ | |
Properties { | |
_Color ("Main Color (A=Opacity)", Color) = (1,1,1,1) | |
_MainTex ("Base (A=Opacity)", 2D) = "" | |
} | |
Category { | |
Tags {"Queue"="Transparent" "IgnoreProjector"="True"} | |
Cull front // ADDED BY BERNIE, TO FLIP THE SURFACES | |
ZWrite Off | |
Blend SrcAlpha OneMinusSrcAlpha | |
SubShader {Pass { | |
GLSLPROGRAM | |
varying mediump vec2 uv; | |
#ifdef VERTEX | |
uniform mediump vec4 _MainTex_ST; | |
void main() { | |
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | |
uv = gl_MultiTexCoord0.xy * _MainTex_ST.xy + _MainTex_ST.zw; | |
} | |
#endif | |
#ifdef FRAGMENT | |
uniform lowp sampler2D _MainTex; | |
uniform lowp vec4 _Color; | |
void main() { | |
gl_FragColor = texture2D(_MainTex, uv) * _Color; | |
} | |
#endif | |
ENDGLSL | |
}} | |
SubShader {Pass { | |
SetTexture[_MainTex] {Combine texture * constant ConstantColor[_Color]} | |
}} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment