Skip to content

Instantly share code, notes, and snippets.

@sgnm
Created October 2, 2018 15:04
Show Gist options
  • Save sgnm/7699fc24d10a4350a69c166eacb6702e to your computer and use it in GitHub Desktop.
Save sgnm/7699fc24d10a4350a69c166eacb6702e to your computer and use it in GitHub Desktop.
correct transparent effect
Shader "Custom/SemiTransparent" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Transparent" "Queue"="Transparent"}
LOD 200
Pass{
ZWrite ON
ColorMask 0
}
CGPROGRAM
#pragma surface surf Standard fullforwardshadows alpha:fade
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
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