URP 编写自定义 Shader (1) URPUnlitShaderBasic
作者:互联网
Shader "Example/URPUnlitShaderBasic" {
Properties {
}
SubShader {
Tags { "RenderType"="Opaque" "RenderPipeline"="UniversalPipeline" }
Pass {
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes {
float4 positionOS : POSITION;
};
struct Varyings {
float4 positionHCS : SV_POSITION;
};
Varyings vert(Attributes IN) {
Varyings OUT;
OUT.positionHCS=TransformObjectToHClip(IN.positionOS.xyz);
return OUT;
}
half4 frag(): SV_Target {
half4 customColor=half4(0.5, 0, 0, 1);
return customColor;
}
ENDHLSL
}
}
}
标签:frag,URPUnlitShaderBasic,自定义,half4,Varyings,URP,float4,OUT 来源: https://www.cnblogs.com/kingBook/p/15894010.html