79 lines
2.1 KiB
Plaintext
79 lines
2.1 KiB
Plaintext
Shader "Unlit URP Shader/OutLine"
|
|
{
|
|
Properties
|
|
{
|
|
_MainTex("MainTex",2d)="white"{}
|
|
_OutLineTex("OutLinrTex",2D)="white"{}
|
|
//_BaseColor("Base Color",color) = (1,1,1,1)
|
|
//_OutLineColor("OutLineColor",color)=(1,1,1,1)
|
|
//_OutLineWide("OutLineWide",float)=1
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
//Tags { "Queue"="Transparent+100" "RenderPipeline" = "UniversalPipeline" }
|
|
Tags { "Queue"="Geometry+10" "RenderPipeline" = "UniversalPipeline" }
|
|
LOD 100
|
|
|
|
Pass
|
|
{
|
|
Name "0_Fill"
|
|
ZWrite On
|
|
ZTest LEqual
|
|
Cull Off
|
|
Stencil
|
|
{
|
|
Ref 2
|
|
Comp Always
|
|
Pass Replace
|
|
Fail Keep
|
|
}
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard srp library
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma multi_compile_fog
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
|
|
|
|
|
|
struct Attributes
|
|
{
|
|
float4 vertex : POSITION;
|
|
float3 normal : NORMAL;
|
|
float3 smoothNormal : TEXCOORD3;
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
float4 position : SV_POSITION;
|
|
float4 color : COLOR;
|
|
};
|
|
|
|
CBUFFER_START(UnityPerMaterial)
|
|
half4 _OutLineColor;
|
|
half _OutLineWide;
|
|
CBUFFER_END
|
|
|
|
|
|
Varyings vert(Attributes v)
|
|
{
|
|
Varyings o = (Varyings)0;
|
|
o.position = TransformObjectToHClip(v.vertex);
|
|
o.color = _OutLineColor;
|
|
o.color.a=_OutLineWide*0.5;//saturate(o.color.a*0.5+_OutLineWide*0.25);
|
|
return o;
|
|
}
|
|
|
|
half4 frag(Varyings i) : SV_Target
|
|
{
|
|
return i.color;
|
|
}
|
|
ENDHLSL
|
|
}
|
|
|
|
|
|
}
|
|
} |