Skip to content

Instantly share code, notes, and snippets.

@sugi-cho
Created July 9, 2013 07:56
Show Gist options
  • Save sugi-cho/5955493 to your computer and use it in GitHub Desktop.
Save sugi-cho/5955493 to your computer and use it in GitHub Desktop.
Shader "Custom/surfaceBillbord" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:vert
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
void vert (inout appdata_full v){
float3 view = mul(_World2Object, float4(_WorldSpaceCameraPos,1)).xyz;
float3 up = float3(0,1,0);
float3 right = normalize(cross(view, up));
v.vertex.xyz = v.vertex.x*right + v.vertex.y*up;
}
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment