Fixed the bug that alpha clip does not working properly;
This commit is contained in:
@@ -4,8 +4,6 @@ Shader "HDRP/Toon"
|
||||
{
|
||||
//TODO: Use custom rendering data.
|
||||
[ToggleUI] _UseShadowThreshold("_UseShadowThreshold", Float) = 0.0
|
||||
[ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
|
||||
_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
_AlphaCutoffShadow("_AlphaCutoffShadow", Range(0.0, 1.0)) = 0.5
|
||||
_AlphaCutoffPrepass("_AlphaCutoffPrepass", Range(0.0, 1.0)) = 0.5
|
||||
_AlphaCutoffPostpass("_AlphaCutoffPostpass", Range(0.0, 1.0)) = 0.5
|
||||
@@ -49,7 +47,6 @@ Shader "HDRP/Toon"
|
||||
[HideInInspector] _AlphaDstBlend("__alphaDst", Float) = 0.0
|
||||
[HideInInspector][ToggleUI] _ZWrite("__zw", Float) = 1.0
|
||||
[HideInInspector][ToggleUI] _TransparentZWrite("_TransparentZWrite", Float) = 0.0
|
||||
//[Enum(Off, 0, Front, 1, Back, 2)] _CullMode("__cullmode", Float) = 2.0
|
||||
[HideInInspector] _CullModeForward("__cullmodeForward", Float) = 2.0 // This mode is dedicated to Forward to correctly handle backface then front face rendering thin transparent
|
||||
[HideInInspector] _TransparentCullMode("_TransparentCullMode", Int) = 2 // Back culling by default
|
||||
[HideInInspector] _ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4 // Less equal
|
||||
@@ -72,7 +69,6 @@ Shader "HDRP/Toon"
|
||||
_Color("Color", Color) = (1,1,1,1)
|
||||
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -86,7 +82,7 @@ Shader "HDRP/Toon"
|
||||
|
||||
// Surface Options
|
||||
[Popup] _TransparentEnabled("Transparent Mode", Integer) = 0
|
||||
[ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
|
||||
[Popup(_ALPHATEST_ON)] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
|
||||
_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
[Enum(Off, 0, Front, 1, Back, 2)] _CullMode("Cull Mode", Integer) = 2
|
||||
[KeywordEnum(Standard, SDF)] _Shading_Mode("Shading mode", Integer) = 0
|
||||
@@ -239,6 +235,22 @@ Shader "HDRP/Toon"
|
||||
_LightIntensityMultiplier("Light_Intensity_Multiplier" , Range(0, 1)) = 0.5
|
||||
[ToggleUI] _ClampLightColor("VRChat : SceneLights HiCut_Filter", Float) = 0
|
||||
[KeywordEnum(Single, Full, Custom)] _Light_Loop_Mode ("Light Loop Mode", Float) = 1
|
||||
|
||||
|
||||
//TODO: Clear hdrp default properties
|
||||
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _UVDetail("UV Set for detail", Float) = 0
|
||||
[HideInInspector] _UVDetailsMappingMask("_UVDetailsMappingMask", Color) = (1, 0, 0, 0)
|
||||
[ToggleUI] _LinkDetailsWithBase("LinkDetailsWithBase", Float) = 1.0
|
||||
|
||||
[Enum(Use Emissive Color, 0, Use Emissive Mask, 1)] _EmissiveColorMode("Emissive color mode", Float) = 1
|
||||
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Planar, 4, Triplanar, 5, Same as Base, 6)] _UVEmissive("UV Set for emissive", Float) = 0
|
||||
[Enum(WorldSpace, 0, ObjectSpace, 1)] _ObjectSpaceUVMappingEmissive("Mapping space", Float) = 0.0
|
||||
_TexWorldScaleEmissive("Scale to apply on world coordinate", Float) = 1.0
|
||||
[HideInInspector] _UVMappingMaskEmissive("_UVMappingMaskEmissive", Color) = (1, 0, 0, 0)
|
||||
|
||||
[HideInInspector] _DiffusionProfile("Obsolete, kept for migration purpose", Int) = 0
|
||||
[HideInInspector] _DiffusionProfileAsset("Diffusion Profile Asset", Vector) = (0, 0, 0, 0)
|
||||
[HideInInspector] _DiffusionProfileHash("Diffusion Profile Hash", Float) = 0
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
@@ -249,15 +261,7 @@ Shader "HDRP/Toon"
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Variant
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
#pragma shader_feature_local _DEPTHOFFSET_ON
|
||||
#pragma shader_feature_local _DOUBLESIDED_ON
|
||||
#pragma shader_feature_local _ _VERTEX_DISPLACEMENT _PIXEL_DISPLACEMENT
|
||||
#pragma shader_feature_local _VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE
|
||||
#pragma shader_feature_local _DISPLACEMENT_LOCK_TILING_SCALE
|
||||
#pragma shader_feature_local _PIXEL_DISPLACEMENT_LOCK_OBJECT_SCALE
|
||||
#pragma shader_feature_local _TESSELLATION_PHONG
|
||||
|
||||
#pragma shader_feature_local _NORMALMAP_TANGENT_SPACE
|
||||
#pragma shader_feature_local _ _REQUIRE_UV2 _REQUIRE_UV3
|
||||
@@ -327,6 +331,7 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
// Note: Require _ObjectId and _PassValue variables
|
||||
|
||||
// We reuse depth prepass for the scene selection, allow to handle alpha correctly as well as tessellation and vertex animation
|
||||
@@ -430,6 +435,7 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
// Lightmap memo
|
||||
// DYNAMICLIGHTMAP_ON is used when we have an "enlighten lightmap" ie a lightmap updated at runtime by enlighten.This lightmap contain indirect lighting from realtime lights and realtime emissive material.Offline baked lighting(from baked material / light,
|
||||
// both direct and indirect lighting) will hand up in the "regular" lightmap->LIGHTMAP_ON.
|
||||
@@ -462,6 +468,8 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
#define SHADERPASS SHADERPASS_SHADOWS
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl"
|
||||
@@ -481,7 +489,7 @@ Shader "HDRP/Toon"
|
||||
Tags{ "LightMode" = "DepthForwardOnly" }
|
||||
|
||||
Cull[_CullMode]
|
||||
|
||||
AlphaToMask [_AlphaCutoffEnable]
|
||||
// To be able to tag stencil with disableSSR information for forward
|
||||
Stencil
|
||||
{
|
||||
@@ -495,6 +503,8 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
// In deferred, depth only pass don't output anything.
|
||||
// In forward it output the normal buffer
|
||||
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
||||
@@ -534,6 +544,7 @@ Shader "HDRP/Toon"
|
||||
}
|
||||
|
||||
Cull[_CullMode]
|
||||
AlphaToMask [_AlphaCutoffEnable]
|
||||
|
||||
ZWrite On
|
||||
|
||||
@@ -541,6 +552,9 @@ Shader "HDRP/Toon"
|
||||
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
||||
#pragma multi_compile _ WRITE_MSAA_DEPTH
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
|
||||
#define SHADERPASS SHADERPASS_MOTION_VECTORS
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl"
|
||||
@@ -603,6 +617,9 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
|
||||
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
||||
#define CUTOFF_TRANSPARENT_DEPTH_PREPASS
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
@@ -630,6 +647,9 @@ Shader "HDRP/Toon"
|
||||
ZTest [_ZTestTransparent]
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
#pragma multi_compile _ DEBUG_DISPLAY
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
@@ -677,12 +697,12 @@ Shader "HDRP/Toon"
|
||||
Pass
|
||||
{
|
||||
Name "ForwardOnly"
|
||||
Tags { "LightMode" = "ForwardOnly" }
|
||||
Tags { "LightMode" = "ForwardOnly" }
|
||||
|
||||
ZWrite [_ZWriteMode]
|
||||
ZTest [_ZTestMode]
|
||||
Cull [_CullMode]
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend]
|
||||
Stencil {
|
||||
|
||||
Ref[_StencilNo]
|
||||
@@ -694,7 +714,6 @@ Shader "HDRP/Toon"
|
||||
}
|
||||
|
||||
HLSLPROGRAM
|
||||
//#pragma multi_compile _ UTS_DEBUG_SHADOWMAP_BINALIZATION
|
||||
#pragma multi_compile _ DEBUG_DISPLAY
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
@@ -716,15 +735,7 @@ Shader "HDRP/Toon"
|
||||
#if !defined(_SURFACE_TYPE_TRANSPARENT) && !defined(DEBUG_DISPLAY)
|
||||
#define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST
|
||||
#endif
|
||||
// used in ShadingGradeMap
|
||||
#pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON
|
||||
#pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON
|
||||
// used in Shadow calculation
|
||||
#pragma shader_feature _ UTS_USE_RAYTRACING_SHADOW
|
||||
// used in DoubleShadeWithFeather
|
||||
#pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE
|
||||
// controlling mask rendering
|
||||
#pragma shader_feature _ _IS_CLIPPING_MATTE
|
||||
|
||||
#pragma shader_feature _EMISSIVE_SIMPLE _EMISSIVE_ANIMATION
|
||||
|
||||
#pragma shader_feature ENABLE_UTS_HAIR_SHAOW
|
||||
@@ -759,6 +770,9 @@ Shader "HDRP/Toon"
|
||||
|
||||
#pragma shader_feature_local_fragment _OUTLINECOLORMAP
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
|
||||
#define PUNCTUAL_SHADOW_MEDIUM
|
||||
#define DIRECTIONAL_SHADOW_MEDIUM
|
||||
#define AREA_SHADOW_MEDIUM
|
||||
@@ -819,6 +833,9 @@ Shader "HDRP/Toon"
|
||||
ColorMask 0
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
||||
#define CUTOFF_TRANSPARENT_DEPTH_POSTPASS
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
@@ -928,6 +945,9 @@ Shader "HDRP/Toon"
|
||||
HLSLPROGRAM
|
||||
|
||||
#define SHADERPASS SHADERPASS_SHADOWS
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl"
|
||||
|
||||
Reference in New Issue
Block a user