157 lines
6.1 KiB
GLSL
157 lines
6.1 KiB
GLSL
// NiloToon Character Fur Shell Only Shader
|
|
// Use this shader on a second material slot to render fur shells
|
|
// The base mesh should use NiloToonCharacter or NiloToonCharacterFur shader
|
|
|
|
Shader "Universal Render Pipeline/NiloToon/NiloToon_Character_Fur_ShellOnly"
|
|
{
|
|
Properties
|
|
{
|
|
[Header(Base Color)]
|
|
[Space(5)]
|
|
[MainTexture] _BaseMap("Base Map", 2D) = "white" {}
|
|
[HDR][MainColor] _BaseColor("Base Color", Color) = (1,1,1,1)
|
|
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
|
|
|
[Header(Normal Map)]
|
|
[Space(5)]
|
|
[Toggle(_NORMALMAP)] _UseNormalMap("Enable Normal Map", Float) = 0
|
|
[Normal] _BumpMap("Normal Map", 2D) = "bump" {}
|
|
_BumpScale("Normal Scale", Range(0, 2)) = 1.0
|
|
|
|
[Header(Fur Shape)]
|
|
[Space(5)]
|
|
_FurNoiseMask("Fur Noise Mask", 2D) = "white" {}
|
|
_FurMask("Fur Mask (where fur appears)", 2D) = "white" {}
|
|
_FurLengthMask("Fur Length Mask", 2D) = "white" {}
|
|
_FurVector("Fur Direction (XYZ) + Length (W)", Vector) = (0, 0, 1, 0.02)
|
|
[Normal] _FurVectorTex("Fur Direction Map (Normal)", 2D) = "bump" {}
|
|
_FurVectorScale("Fur Direction Scale", Range(-10, 10)) = 1.0
|
|
_FurGravity("Fur Gravity", Range(0, 1)) = 0.25
|
|
_FurRandomize("Fur Randomize", Range(0, 1)) = 0.1
|
|
_FurAO("Fur Ambient Occlusion", Range(0, 1)) = 0.5
|
|
|
|
[Header(Shell Layers)]
|
|
[Space(5)]
|
|
[IntRange] _FurLayerNum("Fur Layer Count", Range(1, 3)) = 2
|
|
_FurRootOffset("Fur Root Offset", Range(-1, 0)) = 0
|
|
|
|
[Header(Fur Rim Light)]
|
|
[Space(5)]
|
|
[HDR] _FurRimColor("Fur Rim Color", Color) = (1, 1, 1, 1)
|
|
_FurRimFresnelPower("Fur Rim Fresnel Power", Range(0.01, 50)) = 3.0
|
|
_FurRimAntiLight("Fur Rim Anti-Light", Range(0, 1)) = 0.5
|
|
|
|
[Header(Cel Shading)]
|
|
[Space(5)]
|
|
_CelShadeMidPoint("Cel Shade Mid Point", Range(-1, 1)) = 0
|
|
_CelShadeSoftness("Cel Shade Softness", Range(0, 1)) = 0.1
|
|
|
|
[Header(Shadow Color)]
|
|
[Space(5)]
|
|
[Toggle(_SHADOW_COLOR)] _EnableShadowColor("Enable Shadow Color", Float) = 0
|
|
[HDR] _ShadowColor("Shadow Tint Color", Color) = (1, 1, 1, 1)
|
|
_ShadowBrightness("Shadow Brightness", Range(0, 2)) = 1.0
|
|
_ShadowHueShift("Shadow Hue Shift", Range(-0.5, 0.5)) = 0
|
|
_ShadowSaturationBoost("Shadow Saturation Boost", Range(0, 2)) = 1.0
|
|
_ShadowValueMultiplier("Shadow Value Multiplier", Range(0, 2)) = 1.0
|
|
|
|
[Header(MatCap Additive)]
|
|
[Space(5)]
|
|
[Toggle(_MATCAP_ADD)] _UseMatCapAdd("Enable MatCap (Add)", Float) = 0
|
|
_MatCapAddMap("MatCap Add Map", 2D) = "black" {}
|
|
[HDR] _MatCapAddColor("MatCap Add Color", Color) = (1, 1, 1, 1)
|
|
_MatCapAddIntensity("MatCap Add Intensity", Range(0, 5)) = 1.0
|
|
_MatCapAddMask("MatCap Add Mask", 2D) = "white" {}
|
|
|
|
[Header(MatCap Multiply)]
|
|
[Space(5)]
|
|
[Toggle(_MATCAP_MUL)] _UseMatCapMul("Enable MatCap (Multiply)", Float) = 0
|
|
_MatCapMulMap("MatCap Multiply Map", 2D) = "white" {}
|
|
_MatCapMulIntensity("MatCap Multiply Intensity", Range(0, 2)) = 1.0
|
|
|
|
[Header(Emission)]
|
|
[Space(5)]
|
|
[Toggle(_EMISSION)] _UseEmission("Enable Emission", Float) = 0
|
|
_EmissionMap("Emission Map", 2D) = "white" {}
|
|
[HDR] _EmissionColor("Emission Color", Color) = (0, 0, 0, 1)
|
|
_EmissionIntensity("Emission Intensity", Range(0, 10)) = 1.0
|
|
|
|
[Header(Occlusion)]
|
|
[Space(5)]
|
|
[Toggle(_OCCLUSIONMAP)] _UseOcclusion("Enable Occlusion Map", Float) = 0
|
|
_OcclusionMap("Occlusion Map", 2D) = "white" {}
|
|
_OcclusionStrength("Occlusion Strength", Range(0, 1)) = 1.0
|
|
|
|
[Header(Outline)]
|
|
[Space(5)]
|
|
_OutlineWidth("Outline Width", Range(0, 10)) = 0
|
|
[HDR] _OutlineColor("Outline Color", Color) = (0, 0, 0, 1)
|
|
_OutlineWidthMask("Outline Width Mask", 2D) = "white" {}
|
|
|
|
[Header(Rendering Options)]
|
|
[Space(5)]
|
|
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull Mode", Float) = 2
|
|
[Enum(UnityEngine.Rendering.CullMode)] _FurCull("Fur Cull Mode", Float) = 0
|
|
[Enum(Off, 0, On, 1)] _ZWrite("ZWrite", Float) = 0
|
|
_FurZWrite("Fur ZWrite", Float) = 0
|
|
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 4
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags
|
|
{
|
|
"RenderType" = "Transparent"
|
|
"RenderPipeline" = "UniversalPipeline"
|
|
"IgnoreProjector" = "True"
|
|
"Queue" = "Transparent-50"
|
|
}
|
|
LOD 300
|
|
|
|
// Fur Shell Pass
|
|
Pass
|
|
{
|
|
Name "FurShell"
|
|
Tags { "LightMode" = "UniversalForward" }
|
|
|
|
Cull [_FurCull]
|
|
ZWrite [_FurZWrite]
|
|
ZTest LEqual
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
|
|
HLSLPROGRAM
|
|
#pragma target 4.5
|
|
#pragma require geometry
|
|
|
|
#pragma shader_feature_local _NORMALMAP
|
|
#pragma shader_feature_local _SHADOW_COLOR
|
|
#pragma shader_feature_local _MATCAP_ADD
|
|
#pragma shader_feature_local _MATCAP_MUL
|
|
#pragma shader_feature_local _RIMLIGHT
|
|
#pragma shader_feature_local _EMISSION
|
|
#pragma shader_feature_local _OCCLUSIONMAP
|
|
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
|
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
|
#pragma multi_compile_fog
|
|
|
|
#pragma multi_compile_instancing
|
|
#pragma instancing_options renderinglayer
|
|
|
|
#pragma vertex vert_fur
|
|
#pragma geometry geom_fur
|
|
#pragma fragment frag_fur
|
|
|
|
#define NILOTOON_FUR_SHELL_PASS
|
|
#include "NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Shared.hlsl"
|
|
#include "NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Geometry.hlsl"
|
|
#include "NiloToonCharacterFur_HLSL/NiloToonCharacterFur_Fragment.hlsl"
|
|
ENDHLSL
|
|
}
|
|
}
|
|
|
|
FallBack Off
|
|
}
|