我需要将2个着色器与标准着色器合并的帮助。 当我这样做时,我会遇到很多错误(我在着色器中是乞gg者)
标准着色器:https://pastebin.com/dqd4qQg2
SHADER 1
Shader "XRay Shaders/Diffuse-Stencil-Write"
{ 性质 { _Color(“主色”,颜色)=(1,1,1,1) _MainTex(“ Base(RGB)”,2D)=“白色” {} }
SubShader
{
Tags { "RenderType" = "Opaque" }
LOD 200
Stencil
{
Ref 1
Comp Always
Pass Replace
ZFail Keep
}
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
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 "Legacy Shaders/VertexLit"
}
SHADER 2
着色器“ X射线着色器/漫射-X射线可替换” { 性质 { _Color(“主色”,颜色)=(1,1,1,1) _EdgeColor(“ XRay Edge Color”,Color)=(0,0,0,0) _MainTex(“ Base(RGB)”,2D)=“白色” {} }
SubShader
{
Tags
{
//////////////////////////////////////////////////////////////////////////////////////////////////////
// In some cases, it's necessary to force XRay objects to render before the rest of the geometry //
// This is so their depth info is already in the ZBuffer, and Occluding objects won't mistakenly //
// write to the Stencil buffer when they shouldn't. //
// //
// This is what "Queue" = "Geometry-1" is for. //
// I didn't bring this up in the video because I'm an idiot. //
// //
// Cheers, //
// Dan //
//////////////////////////////////////////////////////////////////////////////////////////////////////
"Queue" = "Geometry-1"
"RenderType" = "Opaque"
"XRay" = "ColoredOutline"
}
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
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 "Legacy Shaders/VertexLit"
}