Make a shader receive lighting

Hello, I have this shader called Curved and it seems to be some kind of unlit material (I have no idea about shaders). I need it to receive lights and shadows like a regular diffuse shader, is it possible?

Shader "Custom/Curved" {
    	Properties {
    		_MainTex ("Base (RGB)", 2D) = "white" {}
    		_QOffset ("Offset", Vector) = (0,0,0,0)
    		_Dist ("Distance", Float) = 100.0
    	}
    	SubShader {
    		Tags { "RenderType"="Opaque" }
    		Pass
    		{
    			CGPROGRAM
    			#pragma vertex vert
    			#pragma fragment frag
    			#include "UnityCG.cginc"
    
                sampler2D _MainTex;
    			float4 _QOffset;
    			float _Dist;
    			
    			struct v2f {
    			    float4 pos : SV_POSITION;
    			    float4 uv : TEXCOORD0;
    			};
    
    			v2f vert (appdata_base v)
    			{
    			    v2f o;
    			    float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
    			    float zOff = vPos.z/_Dist;
    			    vPos += _QOffset*zOff*zOff;
    			    o.pos = mul (UNITY_MATRIX_P, vPos);
    			    o.uv = v.texcoord;
    			    return o;
    			}
    
    			half4 frag (v2f i) : COLOR
    			{
    			    half4 col = tex2D(_MainTex, i.uv.xy);
    			    return col;
    			}
    			ENDCG
    		}
    	}
    	FallBack "Diffuse"
    }

Thank you guys!

There is a (very) similar topic here.

As I don’t know a thing about shaders I don’t really understand the linked topic you posted. Even though, I tried to add some “Pass shadow collector” stuff into my shader but (as expected) it didn’t work :frowning:

If you’re having trouble with shaders and don’t know how to (properly) make them, you’re going to have a hard time getting some stuff to work properly. I would strongly suggest getting a bit more know how into shaders.

The post jvo3dc linked deals with a similar situation. It’s exactly the same shader, except yours is not a surface shader, but defines its own vertex and fragment programs. I haven’t read anything in detail yet in the provided link, but it seems the solution for a surface shader is in there.

Should you want to keep it as a vertex/fragment shader, you will need to get the shadow information manually. The best link I found is this one. It shows you what is needed to handle multiple lights for diffuse shading, but the implementation way also handles shadows.

For a shader that modifies vertex position your gonna have to modify the shadow position as well, if not the shadows wont follow(Requiring you to write your own shadow collector/shadow caster passes). It will be tricky for you to change this with limited experience. I recommend watching this if your genuinely interested in learning shaders .
Prime 31’s basic shader guide :

Its well made for beginners and would be a good place to start for you. They also cover how to calculate lighting as well. Good luck.