Shadow Catcher Material

Include the following details (edit as applicable):

  • Issue category: Real-time Mapping-Depth / ARDK Documentation / Sample App aka ‘AR Developer Tools
  • Device type & OS version: Android / iOS
  • Host machine & OS version: Mac Ventura, M1
  • Issue Environment : Unity Mock / On Device
  • Xcode version:
  • ARDK version: 2.3.1.
  • Unity version: 2021.3.16

Description of the issue:

Hi y’all. I’m trying to create / find a material / shader, that serves as a shadow caster only, meaning I can attach it to detected planes / meshes or onto a normal Plane game object and it will only cast shadows from other objects.

I found a few tutorials on how to do that in URP:

However none seems to work for me. Would be happy about some advice / material that works with ARDK

cheers and thanks in advance

Hey @Tobias_Reidl

Here is a shader that i use in some of my AR projects to cast shadows on planes:
Shader “URP AR Shadow Receiver”
_ShadowColor (“Shadow Color”, Color) = (0.35,0.4,0.45,1.0)


        Name "ForwardLit"
        Tags { "LightMode" = "UniversalForward" }

        Blend DstColor Zero, Zero One
        Cull Back
        ZTest LEqual
        ZWrite Off

        #pragma vertex vert
        #pragma fragment frag

        #pragma prefer_hlslcc gles
        #pragma exclude_renderers d3d11_9x
        #pragma target 2.0

        #pragma multi_compile _ _MAIN_LIGHT_SHADOWS
        #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
        #pragma multi_compile _ _SHADOWS_SOFT
        #pragma multi_compile_fog

        #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"

        float4 _ShadowColor;

        struct Attributes
            float4 positionOS : POSITION;

        struct Varyings
            float4 positionCS               : SV_POSITION;
            float3 positionWS               : TEXCOORD0;
            float fogCoord                  : TEXCOORD1;

        Varyings vert (Attributes input)
            Varyings output = (Varyings)0;

            UNITY_TRANSFER_INSTANCE_ID(input, output);

            VertexPositionInputs vertexInput = GetVertexPositionInputs(;
            output.positionCS = vertexInput.positionCS;
            output.positionWS = vertexInput.positionWS;
            output.fogCoord = ComputeFogFactor(vertexInput.positionCS.z);

            return output;

        half4 frag (Varyings input) : SV_Target

            half4 color = half4(1,1,1,1);

        #ifdef _MAIN_LIGHT_SHADOWS
            VertexPositionInputs vertexInput = (VertexPositionInputs)0;
            vertexInput.positionWS = input.positionWS;

            float4 shadowCoord = GetShadowCoord(vertexInput);
            half shadowAttenutation = MainLightRealtimeShadow(shadowCoord);
            color = lerp(half4(1,1,1,1), _ShadowColor, (1.0 - shadowAttenutation) * _ShadowColor.a);
            color.rgb = MixFogColor(color.rgb, half3(1,1,1), input.fogCoord);
            return color;



But be aware that for this to work you have to toggle “transparent recieve shadows” on in your renderer asset here:
Screenshot 2023-01-17 at 10.25.11

1 Like

If you want a premade solution, I got a free version on the asset store as well:

1 Like

@Merijn_Kersten @Dylan_Smit , thanks a lot you guys, sadly both solutions do not work for me. The weird thing is that it seems like I do not get shadows on transparent surfaces at all despite activating Transparent Receive shadows…

Take a look at the screenshots, here I tested a normal material, semi transparent and the Shadow Receiver URP Free :

Disable shadow cascades. No free version supports it currently. Might help?

1 Like

Oh yes! Works like a charm, thanks a bunch @Dylan_Smit !

This topic was automatically closed 2 hours after the last reply. New replies are no longer allowed.