URP中基础Shader

Shader "Unlit/URPTestShader"
{
Properties
{
_BaseColor("BaseColor", Color) = (1,1,1,1)
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" "RanderPipeline" = "UniversalPipeline" }

    Pass//URP单Pass前项渲染的管线
    {
		HLSLPROGRAM//使用HLSL语言
		#pragma vertex vert
        #pragma fragment frag
		#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"//引入URP核心文件
		
		sampler2D _MainTex;
        //float4 _MainTex_ST;
		//half4 _BaseColor;
		
		//兼容SRP属性
		CBUFFER_START(UnityPerMaterial)
			float4 _MainTex_ST;
			half4 _BaseColor;
		CBUFFER_END

		struct appdata
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
        };

        struct v2f
        {
            float2 uv : TEXCOORD0;
            float4 vertex : SV_POSITION;
        };

        v2f vert (appdata v)
        {
            v2f o;
            o.vertex = TransformObjectToHClip(v.vertex.xyz);//
            o.uv = TRANSFORM_TEX(v.uv, _MainTex);
            return o;
        }

        half4 frag (v2f i) : SV_Target//HLSL中不再使用fixed类型(精度低)
        {
            // sample the texture
            half4 col = tex2D(_MainTex, i.uv)*_BaseColor;
            return col;
        }
		ENDHLSL
    }
}

}
内置管线Shader升级到URP详细手册