-
-
Save antonsem/b294fa7b7443e017599ee7a87a22b8b4 to your computer and use it in GitHub Desktop.
Shader "AR Proxy" | |
{ | |
Properties | |
{ | |
} | |
SubShader | |
{ | |
Tags | |
{ | |
"RenderType" = "Transparent" | |
"RenderPipeline" = "UniversalPipeline" | |
"IgnoreProjector" = "True" | |
} | |
LOD 300 | |
Pass | |
{ | |
Name "AR Proxy" | |
Tags | |
{ | |
"LightMode" = "LightweightForward" | |
} | |
Blend SrcAlpha OneMinusSrcAlpha | |
ZWrite On | |
Cull Off | |
HLSLPROGRAM | |
#pragma prefer_hlslcc gles | |
#pragma exclude_renderers d3d11_9x | |
#pragma target 2.0 | |
// ------------------------------------- | |
// Material Keywords | |
#pragma shader_feature _ALPHATEST_ON | |
#pragma shader_feature _ALPHAPREMULTIPLY_ON | |
// ------------------------------------- | |
// Lightweight Pipeline keywords | |
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS | |
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE | |
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS | |
#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS | |
#pragma multi_compile _ _SHADOWS_SOFT | |
// ------------------------------------- | |
// Unity defined keywords | |
#pragma multi_compile _ DIRLIGHTMAP_COMBINED | |
#pragma multi_compile _ LIGHTMAP_ON | |
//-------------------------------------- | |
// GPU Instancing | |
#pragma multi_compile_instancing | |
#pragma vertex HiddenVertex | |
#pragma fragment HiddenFragment | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" | |
struct Attributes | |
{ | |
UNITY_VERTEX_INPUT_INSTANCE_ID | |
float4 positionOS : POSITION; | |
}; | |
struct Varyings | |
{ | |
float4 positionCS : SV_POSITION; | |
float4 shadowCoord : TEXCOORD0; | |
}; | |
Varyings HiddenVertex(Attributes input) | |
{ | |
Varyings output = (Varyings)0; | |
UNITY_SETUP_INSTANCE_ID(input); | |
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); | |
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz); | |
output.shadowCoord = GetShadowCoord(vertexInput); | |
output.positionCS = vertexInput.positionCS; | |
return output; | |
} | |
half4 HiddenFragment(Varyings input) : SV_Target | |
{ | |
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); | |
half s = MainLightRealtimeShadow(input.shadowCoord); | |
return half4(0, 0, 0, 1 - s); | |
} | |
ENDHLSL | |
} | |
UsePass "Universal Render Pipeline/Lit/DepthOnly" | |
} | |
FallBack "Hidden/InternalErrorShader" | |
} |
Does not work with URP 7.2.1 Gives pink color.
It works for me but it has a gray color instead of completely transparent.
Render Queue Transparency at 3000 does make the material transparent, yes. But it also nullifies the Occlusion for me, I can see the object completely.
Anyone found a solution for this?
I figured out that it works only with URP installed and enabled. For transparency set Render Queue 3000
…
On Fri, Jul 17, 2020, 20:24 Dilmer Valecillos @.> wrote: @.* commented on this gist. ------------------------------ It works for me but it has a gray color instead of completely transparent. — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://gist.github.com/b294fa7b7443e017599ee7a87a22b8b4#gistcomment-3381495, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVQ46ZKGB4BFSZLKV2GLN3R4CCNLANCNFSM4KXCMCJQ .
Thank you for this! Works like a charm here. 2020.3.1f1 (LTS) with URP 10.3.2. using it together with AR Foundation PlaneOcclusionShader to render shadows on the ground. Really awesome work dude!
Updated for Universal Render Pipeline 7.2.1