vault backup: 2024-10-08 20:03:36
This commit is contained in:
parent
fffce22833
commit
8cb4a84deb
@ -751,3 +751,43 @@ float4 fragShadingGradeMap(VertexOutput i, fixed facing : VFACE) : SV_TARGET
|
|||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```c++
|
||||||
|
else if (stencilMode == _UTS_StencilMode.StencilMask)
|
||||||
|
{
|
||||||
|
material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest - 1;
|
||||||
|
}
|
||||||
|
else if (stencilMode == _UTS_StencilMode.StencilOut)
|
||||||
|
{
|
||||||
|
material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApplyStencilMode(Material material)
|
||||||
|
{
|
||||||
|
_UTS_StencilMode mode = (_UTS_StencilMode)(material.GetInt(ShaderPropStencilMode));
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case _UTS_StencilMode.Off:
|
||||||
|
// material.SetInt(ShaderPropStencilNo,0);
|
||||||
|
material.SetInt(ShaderPropStencilComp, (int)_StencilCompFunction.Disabled);
|
||||||
|
material.SetInt(ShaderPropStencilOpPass, (int)_StencilOperation.Keep);
|
||||||
|
material.SetInt(ShaderPropStencilOpFail, (int)_StencilOperation.Keep);
|
||||||
|
break;
|
||||||
|
case _UTS_StencilMode.StencilMask:
|
||||||
|
// material.SetInt(ShaderPropStencilNo,0);
|
||||||
|
material.SetInt(ShaderPropStencilComp, (int)_StencilCompFunction.Always);
|
||||||
|
material.SetInt(ShaderPropStencilOpPass, (int)_StencilOperation.Replace);
|
||||||
|
material.SetInt(ShaderPropStencilOpFail, (int)_StencilOperation.Replace);
|
||||||
|
break;
|
||||||
|
case _UTS_StencilMode.StencilOut:
|
||||||
|
// material.SetInt(ShaderPropStencilNo,0);
|
||||||
|
material.SetInt(ShaderPropStencilComp, (int)_StencilCompFunction.NotEqual);
|
||||||
|
material.SetInt(ShaderPropStencilOpPass, (int)_StencilOperation.Keep);
|
||||||
|
material.SetInt(ShaderPropStencilOpFail, (int)_StencilOperation.Keep);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|

|
BIN
08-Assets/Others/Unity Shader入门精要[u3dnotes.com].pdf
(Stored with Git LFS)
Normal file
BIN
08-Assets/Others/Unity Shader入门精要[u3dnotes.com].pdf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user