Skip to content

Instantly share code, notes, and snippets.

@CarlLee
Created September 18, 2019 08:55
Show Gist options
  • Save CarlLee/e57276a2f72c0f35c58de474ed570ce6 to your computer and use it in GitHub Desktop.
Save CarlLee/e57276a2f72c0f35c58de474ed570ce6 to your computer and use it in GitHub Desktop.
Unity See through shader
Shader "Unlit/SeeThrough"
{
Properties
{
_Color ("Color", Color) = (1.0, 1.0, 1.0, 1.0)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue" = "Transparent" }
LOD 100
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
float4 vertex : SV_POSITION;
};
float4 _Color;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return _Color;
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment