Skip to content

Instantly share code, notes, and snippets.

@TocaLucas
Created September 26, 2013 14:08
Show Gist options
  • Save TocaLucas/6714741 to your computer and use it in GitHub Desktop.
Save TocaLucas/6714741 to your computer and use it in GitHub Desktop.
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