Created
February 14, 2017 15:20
-
-
Save Chman/6d540e975891b080f69b9ec949444e95 to your computer and use it in GitHub Desktop.
Dummy transparent shader that writes to depth (per request)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/Transparent Write To Depth" | |
{ | |
Properties | |
{ | |
_Color ("Color (RGBA)", Color) = (1.0, 1.0, 1.0, 0.5) | |
} | |
SubShader | |
{ | |
Pass | |
{ | |
Tags { "LightMode"="ForwardBase" "RenderType"="Transparent" "Queue"="Transparent" } | |
LOD 200 | |
ZWrite Off | |
Blend SrcAlpha OneMinusSrcAlpha | |
CGPROGRAM | |
#pragma vertex Vert | |
#pragma fragment Frag | |
#include "UnityCG.cginc" | |
float4 _Color; | |
struct Varyings | |
{ | |
float4 vertex : SV_POSITION; | |
}; | |
Varyings Vert(appdata_base v) | |
{ | |
Varyings o; | |
o.vertex = UnityObjectToClipPos(v.vertex); | |
return o; | |
} | |
float4 Frag(Varyings i) : SV_Target | |
{ | |
return _Color; | |
} | |
ENDCG | |
} | |
Pass | |
{ | |
Tags { "LightMode"="ShadowCaster" "RenderType"="Opaque" "Queue"="Geometry" } | |
CGPROGRAM | |
#pragma vertex Vert | |
#pragma fragment Frag | |
#pragma multi_compile_shadowcaster | |
#include "UnityCG.cginc" | |
struct Varyings | |
{ | |
V2F_SHADOW_CASTER; | |
}; | |
Varyings Vert(appdata_base v) | |
{ | |
Varyings o; | |
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) | |
return o; | |
} | |
float4 Frag(Varyings i) : SV_Target | |
{ | |
SHADOW_CASTER_FRAGMENT(i) | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment