Casting shadow, without rendering the light itself???

Is there any way to cast shadow of a particular object without rendering the light itself???

I am actually working on a project where i need to use a spotlight to cast hard shadow of an object but i don’t want to show the light itself??? Is there any way to invisible the light without disabling the shadow itself???

Please help…

and thanks in advance…

What you want is a shader with a cutom lighting which hides the texture where there is no light.

Here is a share you can use on your material; in your spolight, be sure to render shadows; add a layer for the spotlight culling mask & objects concerned by the light.

I am pretty new with shaders, so don’t use my code “as is”.
It is not perfect, shadows are aliased. In order to fill the whole target, you will need to change the spot angle (because texture out of the light circle is now hidden).

You will need to know a bit of CGShader in order to make it perfect.

Hope this helps !

Shader "Custom/NoLight" {
	Properties {
		_Color ("Color", Color) = (1,1,1,1)
		_MainTex ("Albedo (RGB)", 2D) = "white" {}
	}
	SubShader {
		Tags { "RenderType"="Opaque" }
		LOD 200
		
		CGPROGRAM
		// Physically based Standard lighting model, and enable shadows on all light types
		//#pragma surface surf Standard fullforwardshadows
		#pragma surface surf SimpleLambert fullforwardshadows

		// Use shader model 3.0 target, to get nicer looking lighting
		#pragma target 3.0
		
		half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten)
		{
			half NdotL = dot (s.Normal, lightDir);
			half4 c;
			
			c.rgb = 0;
			
			if (atten > 0 && any(_LightColor0.rgb))
				c.rgb = s.Albedo * 2 ;
				
			c.a = s.Alpha;
			
			return c;
		}

		sampler2D _MainTex;

		struct Input {
			float2 uv_MainTex;
		};

		half _Glossiness;
		half _Metallic;
		fixed4 _Color;

		void surf (Input IN, inout SurfaceOutput o)
		{
			fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
			o.Albedo = c.rgb;
			o.Alpha = c.a;
		}
		ENDCG
	} 
	Fallback "Diffuse"
}

Asset store “DynamicShadowProjector”