Problems with combining those two shaders

hey everybody !
I need to combine those two shaders please , I dont know nothing about shaders because I’m a newbie to the unity universe , and i need your help please .

the first shader is that one , made Bunny83 that allow me to curve my level because I make an endless game .

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"
}

the seconde one is a simple diffuse shader that allow me to cast shadows and light on my objects , because the first one dont allow to do that .

Shader "VertexLit" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,0)
        _SpecColor ("Spec Color", Color) = (1,1,1,1)
        _Emission ("Emmisive Color", Color) = (0,0,0,0)
        _Shininess ("Shininess", Range (0.01, 1)) = 0.7
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    SubShader {
        Pass {
            Material {
                Diffuse [_Color]
                Ambient [_Color]
                Shininess [_Shininess]
                Specular [_SpecColor]
                Emission [_Emission]
            }
            Lighting On
            SeparateSpecular On
            SetTexture [_MainTex] {
                Combine texture * primary DOUBLE, texture * primary
            }
        }
    }
}

please help me , it will be so nice !

You can do this by making a surface shader with a vertex modifier function. (Unity - Manual: Surface Shader examples, do a find on “vertex”) I’ll see if I can make one that works for you.

This will work, but be warned, the shadows don’t correctly fit the bent world. If you have a gradual enough curve, then you shouldn’t notice anything, but with 1 unit per 10 distance it didn’t look very good. (Lightmaps should work perfectly though.)

Shader "Custom/WorldCurve" {
	Properties {
		_MainTex ("Base (RGB)", 2D) = "white" {}
		 _QOffset ("Offset", Vector) = (0,0,0,0)
        _Dist ("Distance", Float) = 100.0
	}
	SubShader {
		Tags { "RenderType"="Opaque" }
		LOD 200
		
		CGPROGRAM
		#pragma surface surf Lambert vertex:vert
		#include "UnityCG.cginc"

		float4 _QOffset;
		float _Dist;
		sampler2D _MainTex;

		struct Input {
			float2 uv_MainTex;
		};

		void vert (inout appdata_full v) {
                	float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
         		float zOff = vPos.z/_Dist;
        		vPos += _QOffset*zOff*zOff;
        		v.vertex = mul (vPos, UNITY_MATRIX_IT_MV);
		}

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

Also, you can just add this to any surface shader you have:

void vert (inout appdata_full v) {
       float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
       float zOff = vPos.z/_Dist;
       vPos += _QOffset*zOff*zOff;
       v.vertex = mul (vPos, UNITY_MATRIX_IT_MV);
}

And also add to the properties

_QOffset ("Offset", Vector) = (0,0,0,0)
_Dist ("Distance", Float) = 100.0

And to #pragma surface surf (Lambert, etc.) add “vertex:vert”