Skip to content

Instantly share code, notes, and snippets.

@jackaperkins
Created September 21, 2016 11:28
Show Gist options
  • Save jackaperkins/f2d0d6e5ee9b400b46027c482f12decf to your computer and use it in GitHub Desktop.
Save jackaperkins/f2d0d6e5ee9b400b46027c482f12decf to your computer and use it in GitHub Desktop.
screenspace.shader
Shader "Unlit/Unlit ScreenSpace" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" "Queue" = "Geometry"}
CGPROGRAM
#pragma surface surf NoLighting noambient
sampler2D _MainTex;
struct Input {
half2 uv_MainTex;
float4 screenPos;
};
fixed4 LightingNoLighting(SurfaceOutput s, fixed3 lightDir, fixed atten)
{
fixed4 c;
c.rgb = s.Albedo * 0.5;
c.a = s.Alpha;
return c;
}
void surf (Input IN, inout SurfaceOutput o)
{
half2 screenUV = IN.screenPos.xy / IN.screenPos.w;
fixed4 sstc = tex2D(_MainTex, screenUV);
o.Albedo = sstc.rgb;// + 0.5f;
}
ENDCG
}
Fallback "Mobile/VertexLit"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment