Created
September 26, 2013 14:08
-
-
Save TocaLucas/6714741 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 "Custom/FrostGL" { | |
Properties { | |
_MainTex ("Frost Map (RGB)", 2D) = "white" {} | |
_FrostColor ("Frost Color", Color) = (1.0, 1.0, 1.0, 1.0) | |
_Mask ("Mask", Vector) = (1.0, 1.0, 1.0, 1.0) | |
} | |
SubShader { | |
Tags { "Queue"="Transparent" "RenderType"="Transparent" } | |
LOD 100 | |
Pass { | |
Blend SrcAlpha OneMinusSrcAlpha | |
ZWrite Off | |
Lighting Off | |
GLSLPROGRAM | |
uniform sampler2D _MainTex; | |
uniform lowp vec4 _Mask; | |
uniform lowp vec3 _FrostColor; | |
varying mediump vec2 uv; | |
#ifdef VERTEX | |
void main() { | |
uv = vec2(gl_MultiTexCoord0); | |
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | |
} | |
#endif | |
#ifdef FRAGMENT | |
const lowp float SMALL = 0.1; | |
const lowp float TWO = 2.0; | |
void main() { | |
lowp vec4 c = texture2D(_MainTex, uv); | |
//lowp float r = step(SMALL, _Mask.x*c.r)*c.r*TWO; | |
//lowp float b = step(SMALL, _Mask.z*c.b)/TWO; | |
gl_FragColor = vec4(_FrostColor, max(max(step(SMALL, _Mask.x*c.r)*c.r*TWO, _Mask.z*c.g), step(SMALL, _Mask.z*c.b)/TWO)); | |
} | |
#endif | |
ENDGLSL | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment