最近工作中突然有描边的小功能,就写了一个shader收藏,顺便分享下,不喜勿喷,欢迎建议,谢谢!
Shader "Unlit/TraceOutLine"
{
Properties
{
//属性
_MainTex("Texture", 2D) = "white" {}
_Diffuse("Color",Color) = (1,1,1,1)
_OutLineColor("OutlineColor",Color) = (1,1,1,1)
_Outline("Outline",Range(0,1)) = 1
}
SubShader
{
//描边shader渲染方式
Tags {"Queue" = "Geometry+1000" "RenderType" = "Opaque" }
Pass
{
Cull Front
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
float4 _OutLineColor;
float _Outline;
struct v2f
{
float4 vertex:SV_POSITION;
|