-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToon Cutout (Stencil).shader
151 lines (136 loc) · 3.67 KB
/
Toon Cutout (Stencil).shader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
Shader "Guerra24/Toon Cutout (Stencil)"
{
Properties
{
[Header(Textures)]
_MainTex("Albedo (RGB)", 2D) = "white" {}
_AlphaCutoff("Cutoff" , Range(0, 1)) = 0.5
_Dark("Albedo Dark (RGB)", 2D) = "white" {}
[Toggle(_NORMALMAP)] _NormalMap("Use Normals", Float) = 0
[Normal] _BumpMap("Normal Map", 2D) = "bump" {}
_BumpMapIntensity("Normal Map Intensity", Range(0, 1)) = 1.0
[Header(Lighting)]
_Sharpness("Sharpness", Range(0, 1)) = 0.1
_IndirectSharpness("Indirect sharpness", Range(0, 0.5)) = 0.05
[Toggle(_USE_NEW_SHADING)] _UseNewShading("Use new shading", Float) = 0
_ShadowColor("Shadow color", Color) = (1.0, 1.0, 1.0, 0.0)
[Toggle(_USE_AMBIENT)] _UseAmbient("Use ambient", Float) = 0
[Header(Edge)]
_EdgeIntensity("Intensity", Range(0, 1)) = 0.0
_EdgeDarkMult("Dark Mult", Range(0, 1)) = 0.25
_EdgeColor("Color", Color) = (1.0, 1.0, 1.0, 0.0)
_EdgeStart("Start" , Range(-1, 0)) = -0.5
_EdgeEnd("End" , Range(-1, 0)) = -0.6
[Toggle(_EDGE_VERTICAL_VECTOR)] _EdgeVerticalVector("Use Vertical Vector", Float) = 0
[Toggle(_USE_LUMINANCE)] _UseLuminance("Use Luminance", Float) = 0
[Header(Specular)]
[Toggle(_USE_SPECULAR)] _UseSpecular("Use Specular", Float) = 0
_SpecularSize("Size", Range(0, 1)) = 0.0
_SpecularIntensity("Intensity", Range(0, 1)) = 1.0
_SpecularIntensityDark("Intensity (Dark)", Range(0, 1)) = 0.5
[Header(Outline)]
_OutlineColor("Color", Color) = (0.5, 0.5, 0.5, 0.0)
_OutlineWidth("Width", Range(0, 0.01)) = 0
_OutlineDepth("Depth", Range(0, 0.05)) = 0.01
_OutlineMulti("Texture Bleed", Range(0, 1)) = 1.0
[Header(Fixed Function)]
[Enum(UnityEngine.Rendering.CullMode)] _CullMode("Cull Mode", Int) = 0
_StencilRef("Stencil Ref", Int) = 0
}
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.universal": "17.0.0"
}
Tags { "Queue" = "Geometry" "RenderPipeline" = "UniversalPipeline" }
Pass
{
Name "UniversalForwardOnly"
Tags { "LightMode" = "UniversalForwardOnly" }
LOD 200
Cull [_CullMode]
Stencil {
Ref [_StencilRef]
Comp Always
Pass Replace
}
HLSLPROGRAM
#include_with_pragmas "./URP/ToonCutoutBase.hlsl"
ENDHLSL
}
//Pass {
// Name "SRPDefaultUnlit"
// Tags { "LightMode" = "SRPDefaultUnlit" }
// LOD 200
// Cull Front
// Stencil {
// Ref [_StencilRef]
// Comp Always
// Pass Replace
// }
// HLSLPROGRAM
// #include_with_pragmas "./URP/ToonCutoutOutline.hlsl"
// ENDHLSL
//}
Pass
{
Name "DepthNormalsOnly"
Tags { "LightMode" = "DepthNormalsOnly" }
LOD 200
Cull [_CullMode]
HLSLPROGRAM
#include_with_pragmas "./URP/ToonDepthBase.hlsl"
ENDHLSL
}
Pass
{
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
LOD 200
Cull Back
ColorMask 0
HLSLPROGRAM
#include_with_pragmas "./URP/ToonShadowCasterBase.hlsl"
ENDHLSL
}
}
SubShader
{
Pass {
Tags { "RenderType" = "Opaque" }
LOD 200
Cull Front
Stencil {
Ref [_StencilRef]
Comp Always
Pass Replace
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "./ToonCutoutOutline.cginc"
ENDCG
}
Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "RenderPipeline" = "" }
LOD 200
Cull [_CullMode]
Stencil {
Ref [_StencilRef]
Comp Always
Pass Replace
}
CGPROGRAM
#pragma surface surf Toon vertex:vert fullforwardshadows addshadow
#pragma shader_feature _NORMALMAP
#pragma shader_feature _USE_LUMINANCE
#pragma shader_feature _USE_SPECULAR
#pragma shader_feature _EDGE_VERTICAL_VECTOR
#pragma shader_feature _USE_NEW_SHADING
#pragma shader_feature _USE_AMBIENT
#pragma target 4.0
#include "./ToonLighting.cginc"
#include "./ToonCutoutBase.cginc"
ENDCG
}
}