Skip to content

Instantly share code, notes, and snippets.

@mmoczkowski
Last active August 29, 2015 14:13
Show Gist options
  • Save mmoczkowski/677456cc7605846fce9c to your computer and use it in GitHub Desktop.
Save mmoczkowski/677456cc7605846fce9c to your computer and use it in GitHub Desktop.
Light rays shader
Shader "Custom/Light rays" {
Properties {
_MainTex ("Rays texture", 2D) = "white" {}
_speed ("Speed", Float) = 0.2
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha One
Cull Off Lighting Off ZWrite Off Fog { Color (0,0,0,0) }
BindChannels {
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
float _speed;
float4 frag(v2f_img i) : COLOR {
i.uv.x += cos(_Time*_speed);
return tex2D(_MainTex, i.uv);
}
ENDCG
}
Pass {
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
float _speed;
float4 frag(v2f_img i) : COLOR {
i.uv.x += sin(_Time*_speed);
return tex2D(_MainTex, i.uv);
}
ENDCG
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment