Fixed the bug that alpha clip does not working properly;
This commit is contained in:
@@ -63,7 +63,7 @@ namespace Misaki.HdrpToon.Editor
|
|||||||
editor.ShaderProperty(Properties.transparentMode, Styles.transparentModeText);
|
editor.ShaderProperty(Properties.transparentMode, Styles.transparentModeText);
|
||||||
|
|
||||||
editor.ShaderProperty(Properties.alphaClipEnable, Styles.alphaClipEnableText);
|
editor.ShaderProperty(Properties.alphaClipEnable, Styles.alphaClipEnableText);
|
||||||
if (Properties.alphaClipEnable.floatValue == 1.0f)
|
if (Properties.alphaClipEnable.GetBooleanValue())
|
||||||
{
|
{
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
editor.ShaderProperty(Properties.alphaClip, Styles.alphaClipText);
|
editor.ShaderProperty(Properties.alphaClip, Styles.alphaClipText);
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ Shader "HDRP/Toon"
|
|||||||
{
|
{
|
||||||
//TODO: Use custom rendering data.
|
//TODO: Use custom rendering data.
|
||||||
[ToggleUI] _UseShadowThreshold("_UseShadowThreshold", Float) = 0.0
|
[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
|
_AlphaCutoffShadow("_AlphaCutoffShadow", Range(0.0, 1.0)) = 0.5
|
||||||
_AlphaCutoffPrepass("_AlphaCutoffPrepass", 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
|
_AlphaCutoffPostpass("_AlphaCutoffPostpass", Range(0.0, 1.0)) = 0.5
|
||||||
@@ -49,7 +47,6 @@ Shader "HDRP/Toon"
|
|||||||
[HideInInspector] _AlphaDstBlend("__alphaDst", Float) = 0.0
|
[HideInInspector] _AlphaDstBlend("__alphaDst", Float) = 0.0
|
||||||
[HideInInspector][ToggleUI] _ZWrite("__zw", Float) = 1.0
|
[HideInInspector][ToggleUI] _ZWrite("__zw", Float) = 1.0
|
||||||
[HideInInspector][ToggleUI] _TransparentZWrite("_TransparentZWrite", Float) = 0.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] _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] _TransparentCullMode("_TransparentCullMode", Int) = 2 // Back culling by default
|
||||||
[HideInInspector] _ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4 // Less equal
|
[HideInInspector] _ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4 // Less equal
|
||||||
@@ -72,7 +69,6 @@ Shader "HDRP/Toon"
|
|||||||
_Color("Color", Color) = (1,1,1,1)
|
_Color("Color", Color) = (1,1,1,1)
|
||||||
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@@ -86,7 +82,7 @@ Shader "HDRP/Toon"
|
|||||||
|
|
||||||
// Surface Options
|
// Surface Options
|
||||||
[Popup] _TransparentEnabled("Transparent Mode", Integer) = 0
|
[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
|
_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||||
[Enum(Off, 0, Front, 1, Back, 2)] _CullMode("Cull Mode", Integer) = 2
|
[Enum(Off, 0, Front, 1, Back, 2)] _CullMode("Cull Mode", Integer) = 2
|
||||||
[KeywordEnum(Standard, SDF)] _Shading_Mode("Shading mode", Integer) = 0
|
[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
|
_LightIntensityMultiplier("Light_Intensity_Multiplier" , Range(0, 1)) = 0.5
|
||||||
[ToggleUI] _ClampLightColor("VRChat : SceneLights HiCut_Filter", Float) = 0
|
[ToggleUI] _ClampLightColor("VRChat : SceneLights HiCut_Filter", Float) = 0
|
||||||
[KeywordEnum(Single, Full, Custom)] _Light_Loop_Mode ("Light Loop Mode", Float) = 1
|
[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
|
HLSLINCLUDE
|
||||||
@@ -249,15 +261,7 @@ Shader "HDRP/Toon"
|
|||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
// Variant
|
// Variant
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#pragma shader_feature_local _ALPHATEST_ON
|
|
||||||
#pragma shader_feature_local _DEPTHOFFSET_ON
|
|
||||||
#pragma shader_feature_local _DOUBLESIDED_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 _NORMALMAP_TANGENT_SPACE
|
||||||
#pragma shader_feature_local _ _REQUIRE_UV2 _REQUIRE_UV3
|
#pragma shader_feature_local _ _REQUIRE_UV2 _REQUIRE_UV3
|
||||||
@@ -327,6 +331,7 @@ Shader "HDRP/Toon"
|
|||||||
|
|
||||||
HLSLPROGRAM
|
HLSLPROGRAM
|
||||||
|
|
||||||
|
#pragma shader_feature_local _ALPHATEST_ON
|
||||||
// Note: Require _ObjectId and _PassValue variables
|
// 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
|
// 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
|
HLSLPROGRAM
|
||||||
|
|
||||||
|
#pragma shader_feature_local _ALPHATEST_ON
|
||||||
// Lightmap memo
|
// 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,
|
// 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.
|
// both direct and indirect lighting) will hand up in the "regular" lightmap->LIGHTMAP_ON.
|
||||||
@@ -462,6 +468,8 @@ Shader "HDRP/Toon"
|
|||||||
|
|
||||||
HLSLPROGRAM
|
HLSLPROGRAM
|
||||||
|
|
||||||
|
#pragma shader_feature_local _ALPHATEST_ON
|
||||||
|
|
||||||
#define SHADERPASS SHADERPASS_SHADOWS
|
#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/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/Lit.hlsl"
|
||||||
@@ -481,7 +489,7 @@ Shader "HDRP/Toon"
|
|||||||
Tags{ "LightMode" = "DepthForwardOnly" }
|
Tags{ "LightMode" = "DepthForwardOnly" }
|
||||||
|
|
||||||
Cull[_CullMode]
|
Cull[_CullMode]
|
||||||
|
AlphaToMask [_AlphaCutoffEnable]
|
||||||
// To be able to tag stencil with disableSSR information for forward
|
// To be able to tag stencil with disableSSR information for forward
|
||||||
Stencil
|
Stencil
|
||||||
{
|
{
|
||||||
@@ -495,6 +503,8 @@ Shader "HDRP/Toon"
|
|||||||
|
|
||||||
HLSLPROGRAM
|
HLSLPROGRAM
|
||||||
|
|
||||||
|
#pragma shader_feature_local _ALPHATEST_ON
|
||||||
|
|
||||||
// In deferred, depth only pass don't output anything.
|
// In deferred, depth only pass don't output anything.
|
||||||
// In forward it output the normal buffer
|
// In forward it output the normal buffer
|
||||||
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
||||||
@@ -534,6 +544,7 @@ Shader "HDRP/Toon"
|
|||||||
}
|
}
|
||||||
|
|
||||||
Cull[_CullMode]
|
Cull[_CullMode]
|
||||||
|
AlphaToMask [_AlphaCutoffEnable]
|
||||||
|
|
||||||
ZWrite On
|
ZWrite On
|
||||||
|
|
||||||
@@ -541,6 +552,9 @@ Shader "HDRP/Toon"
|
|||||||
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
||||||
#pragma multi_compile _ WRITE_MSAA_DEPTH
|
#pragma multi_compile _ WRITE_MSAA_DEPTH
|
||||||
|
|
||||||
|
#pragma shader_feature_local _ALPHATEST_ON
|
||||||
|
|
||||||
|
|
||||||
#define SHADERPASS SHADERPASS_MOTION_VECTORS
|
#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/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/Lit.hlsl"
|
||||||
@@ -603,6 +617,9 @@ Shader "HDRP/Toon"
|
|||||||
|
|
||||||
HLSLPROGRAM
|
HLSLPROGRAM
|
||||||
|
|
||||||
|
#pragma shader_feature_local _ALPHATEST_ON
|
||||||
|
|
||||||
|
|
||||||
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
||||||
#define CUTOFF_TRANSPARENT_DEPTH_PREPASS
|
#define CUTOFF_TRANSPARENT_DEPTH_PREPASS
|
||||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||||
@@ -630,6 +647,9 @@ Shader "HDRP/Toon"
|
|||||||
ZTest [_ZTestTransparent]
|
ZTest [_ZTestTransparent]
|
||||||
|
|
||||||
HLSLPROGRAM
|
HLSLPROGRAM
|
||||||
|
|
||||||
|
#pragma shader_feature_local _ALPHATEST_ON
|
||||||
|
|
||||||
#pragma multi_compile _ DEBUG_DISPLAY
|
#pragma multi_compile _ DEBUG_DISPLAY
|
||||||
#pragma multi_compile _ LIGHTMAP_ON
|
#pragma multi_compile _ LIGHTMAP_ON
|
||||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||||
@@ -677,12 +697,12 @@ Shader "HDRP/Toon"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "ForwardOnly"
|
Name "ForwardOnly"
|
||||||
Tags { "LightMode" = "ForwardOnly" }
|
Tags { "LightMode" = "ForwardOnly" }
|
||||||
|
|
||||||
ZWrite [_ZWriteMode]
|
ZWrite [_ZWriteMode]
|
||||||
ZTest [_ZTestMode]
|
ZTest [_ZTestMode]
|
||||||
Cull [_CullMode]
|
Cull [_CullMode]
|
||||||
Blend SrcAlpha OneMinusSrcAlpha
|
Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend]
|
||||||
Stencil {
|
Stencil {
|
||||||
|
|
||||||
Ref[_StencilNo]
|
Ref[_StencilNo]
|
||||||
@@ -694,7 +714,6 @@ Shader "HDRP/Toon"
|
|||||||
}
|
}
|
||||||
|
|
||||||
HLSLPROGRAM
|
HLSLPROGRAM
|
||||||
//#pragma multi_compile _ UTS_DEBUG_SHADOWMAP_BINALIZATION
|
|
||||||
#pragma multi_compile _ DEBUG_DISPLAY
|
#pragma multi_compile _ DEBUG_DISPLAY
|
||||||
#pragma multi_compile _ LIGHTMAP_ON
|
#pragma multi_compile _ LIGHTMAP_ON
|
||||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||||
@@ -716,15 +735,7 @@ Shader "HDRP/Toon"
|
|||||||
#if !defined(_SURFACE_TYPE_TRANSPARENT) && !defined(DEBUG_DISPLAY)
|
#if !defined(_SURFACE_TYPE_TRANSPARENT) && !defined(DEBUG_DISPLAY)
|
||||||
#define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST
|
#define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST
|
||||||
#endif
|
#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 _EMISSIVE_SIMPLE _EMISSIVE_ANIMATION
|
||||||
|
|
||||||
#pragma shader_feature ENABLE_UTS_HAIR_SHAOW
|
#pragma shader_feature ENABLE_UTS_HAIR_SHAOW
|
||||||
@@ -759,6 +770,9 @@ Shader "HDRP/Toon"
|
|||||||
|
|
||||||
#pragma shader_feature_local_fragment _OUTLINECOLORMAP
|
#pragma shader_feature_local_fragment _OUTLINECOLORMAP
|
||||||
|
|
||||||
|
#pragma shader_feature_local _ALPHATEST_ON
|
||||||
|
|
||||||
|
|
||||||
#define PUNCTUAL_SHADOW_MEDIUM
|
#define PUNCTUAL_SHADOW_MEDIUM
|
||||||
#define DIRECTIONAL_SHADOW_MEDIUM
|
#define DIRECTIONAL_SHADOW_MEDIUM
|
||||||
#define AREA_SHADOW_MEDIUM
|
#define AREA_SHADOW_MEDIUM
|
||||||
@@ -819,6 +833,9 @@ Shader "HDRP/Toon"
|
|||||||
ColorMask 0
|
ColorMask 0
|
||||||
|
|
||||||
HLSLPROGRAM
|
HLSLPROGRAM
|
||||||
|
|
||||||
|
#pragma shader_feature_local _ALPHATEST_ON
|
||||||
|
|
||||||
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
||||||
#define CUTOFF_TRANSPARENT_DEPTH_POSTPASS
|
#define CUTOFF_TRANSPARENT_DEPTH_POSTPASS
|
||||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||||
@@ -928,6 +945,9 @@ Shader "HDRP/Toon"
|
|||||||
HLSLPROGRAM
|
HLSLPROGRAM
|
||||||
|
|
||||||
#define SHADERPASS SHADERPASS_SHADOWS
|
#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/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/Lit.hlsl"
|
||||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl"
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl"
|
||||||
|
|||||||
@@ -124,11 +124,11 @@ UTSSurfaceData GetUTSSurfaceData(FragInputs input, float3 V)
|
|||||||
|
|
||||||
float4 normalLocal = float4(0, 0, 1.0, 1.0);
|
float4 normalLocal = float4(0, 0, 1.0, 1.0);
|
||||||
#if _NORMALMAP
|
#if _NORMALMAP
|
||||||
if (_Use_SSSLut)
|
// if (_Use_SSSLut)
|
||||||
{
|
// {
|
||||||
normalLocal = SAMPLE_TEXTURE2D_LOD(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap), _SSSIntensity);
|
// normalLocal = SAMPLE_TEXTURE2D_LOD(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap), _SSSIntensity);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
{
|
||||||
normalLocal = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap));
|
normalLocal = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap));
|
||||||
normalLocal.rgb = UnpackNormalScale(normalLocal, _NormalScale);
|
normalLocal.rgb = UnpackNormalScale(normalLocal, _NormalScale);
|
||||||
@@ -190,7 +190,8 @@ UTSSurfaceData GetUTSSurfaceData(FragInputs input, float3 V)
|
|||||||
output.geomNormalWS = input.tangentToWorld[2];
|
output.geomNormalWS = input.tangentToWorld[2];
|
||||||
output.tangentWS = Orthonormalize(input.tangentToWorld[0].rgb, normalWS);
|
output.tangentWS = Orthonormalize(input.tangentToWorld[0].rgb, normalWS);
|
||||||
|
|
||||||
output.subsurfaceColor = SAMPLE_TEXTURE2D(_SSSLutMap, s_linear_clamp_sampler, TRANSFORM_TEX(input.texCoord0, _BaseColorMap)) * _SSSIntensity;
|
// output.subsurfaceColor = SAMPLE_TEXTURE2D(_SSSLutMap, s_linear_clamp_sampler, TRANSFORM_TEX(input.texCoord0, _BaseColorMap)) * _SSSIntensity;
|
||||||
|
output.subsurfaceColor = 0.0;
|
||||||
|
|
||||||
output.anisotropy = anisotropy;
|
output.anisotropy = anisotropy;
|
||||||
|
|
||||||
@@ -583,4 +584,4 @@ float3 SampleBakedGI_UTS_OutLine(float3 positionRWS, float3 normalWS, float2 uvS
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif //#ifndef UCTS_HDRP_INCLUDED
|
#endif //#ifndef UCTS_HDRP_INCLUDED
|
||||||
|
|||||||
@@ -391,4 +391,4 @@ void UtsGetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInput
|
|||||||
RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS
|
RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -11,13 +11,6 @@ void UTS_OtherLights(LightLoopContext lightLoopContext, FragInputs input, UTSLig
|
|||||||
|
|
||||||
// We dont have to calculate lighting here if we are using sdf shadow
|
// We dont have to calculate lighting here if we are using sdf shadow
|
||||||
#ifndef _SDFShadow
|
#ifndef _SDFShadow
|
||||||
#ifdef _IS_CLIPPING_MATTE
|
|
||||||
if (_ClippingMatteMode != 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
return float3(0.0f, 0.0f, 0.0f);
|
|
||||||
}
|
|
||||||
#endif // _IS_CLIPPING_MATTE
|
|
||||||
|
|
||||||
uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize();
|
uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize();
|
||||||
// input.positionSS is SV_Position
|
// input.positionSS is SV_Position
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
// Surface Option
|
// Surface Option
|
||||||
float _SurfaceFeatures;
|
float _SurfaceFeatures;
|
||||||
|
half _AlphaCutoffEnable;
|
||||||
|
float _AlphaCutoff;
|
||||||
|
|
||||||
// Shading Color
|
// Shading Color
|
||||||
float4 _BaseColor;
|
float4 _BaseColor;
|
||||||
@@ -58,8 +60,8 @@ float _ToonSpecularFeather;
|
|||||||
float _BSDFContribution;
|
float _BSDFContribution;
|
||||||
float _EnergyConservingSpecularColor;
|
float _EnergyConservingSpecularColor;
|
||||||
|
|
||||||
float _SSSIntensity;
|
// float _SSSIntensity;
|
||||||
int _Use_SSSLut;
|
// int _Use_SSSLut;
|
||||||
|
|
||||||
float3 _EmissiveColor;
|
float3 _EmissiveColor;
|
||||||
half _AlbedoAffectEmissive;
|
half _AlbedoAffectEmissive;
|
||||||
@@ -118,11 +120,12 @@ float _LightIntensityMultiplier;
|
|||||||
// Light Loop
|
// Light Loop
|
||||||
float3 _ObjectCenterPositionWS;
|
float3 _ObjectCenterPositionWS;
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Not sure what these are for
|
// NOTE: Not sure what these are for
|
||||||
// float _FirstShadeOverridden;
|
// float _FirstShadeOverridden;
|
||||||
// float _SecondShadeOverridden;
|
// float _SecondShadeOverridden;
|
||||||
|
|
||||||
|
float _UseShadowThreshold;
|
||||||
|
float _AlphaCutoffShadow;
|
||||||
float _ComposerMaskMode;
|
float _ComposerMaskMode;
|
||||||
|
|
||||||
#if defined(_UTS_TOON_EV_PER_MODEL)
|
#if defined(_UTS_TOON_EV_PER_MODEL)
|
||||||
|
|||||||
@@ -82,12 +82,7 @@ void Frag(PackedVaryingsToPS packedInput,
|
|||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef _IS_CLIPPING_MATTE
|
|
||||||
if (_ClippingMatteMode != 0)
|
|
||||||
{
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
#endif // _IS_CLIPPING_MATTE
|
|
||||||
#if defined(UTS_DEBUG_SHADOWMAP_NO_OUTLINE)
|
#if defined(UTS_DEBUG_SHADOWMAP_NO_OUTLINE)
|
||||||
discard;
|
discard;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -146,26 +146,23 @@ void Frag(PackedVaryingsToPS packedInput,
|
|||||||
// Initialize the contactShadow and contactShadowFade fields
|
// Initialize the contactShadow and contactShadowFade fields
|
||||||
InitContactShadow(posInput, context);
|
InitContactShadow(posInput, context);
|
||||||
|
|
||||||
float channelAlpha = 0.0f;
|
|
||||||
|
|
||||||
LightLoopOutput lightLoopOutput;
|
LightLoopOutput lightLoopOutput;
|
||||||
ZERO_INITIALIZE(LightLoopOutput, lightLoopOutput);
|
ZERO_INITIALIZE(LightLoopOutput, lightLoopOutput);
|
||||||
|
|
||||||
UtsLightLoop(input, posInput, bsdfData, builtinData, V, featureFlags, lightLoopOutput);
|
UtsLightLoop(input, posInput, bsdfData, builtinData, V, featureFlags, lightLoopOutput);
|
||||||
|
|
||||||
float3 finalColor = lightLoopOutput.diffuseLighting + lightLoopOutput.specularLighting;
|
float3 finalColor = lightLoopOutput.diffuseLighting + lightLoopOutput.specularLighting;
|
||||||
|
|
||||||
#ifdef _IS_TRANSCLIPPING_OFF
|
|
||||||
|
|
||||||
outColor = float4(finalColor, 1 * ApplyChannelAlpha(channelAlpha));
|
|
||||||
|
|
||||||
#elif _IS_TRANSCLIPPING_ON
|
|
||||||
|
|
||||||
float Set_Opacity = saturate((inverseClipping + _Tweak_transparency));
|
// #if _SURFACE_TYPE_TRANSPARENT
|
||||||
|
// float alpha = channelAlpha;
|
||||||
outColor = EvaluateAtmosphericScattering(posInput, V, float4(finalColor, 1));
|
// outColor = EvaluateAtmosphericScattering(posInput, V, float4(finalColor, 1));
|
||||||
outColor = float4(outColor.rgb, Set_Opacity * ApplyChannelAlpha(channelAlpha));
|
// #else
|
||||||
#endif
|
// float alpha = lerp(1.0, channelAlpha, _AlphaCutoffEnable);
|
||||||
|
// #endif
|
||||||
|
//
|
||||||
|
// alpha = lerp(alpha, step(_AlphaCutoff, alpha), _AlphaCutoffEnable);
|
||||||
|
outColor = float4(finalColor, 1.0);
|
||||||
|
|
||||||
#if _MATERIAL_TYPE_FRONTHAIR && ENABLE_UTS_HAIR_BLENDING
|
#if _MATERIAL_TYPE_FRONTHAIR && ENABLE_UTS_HAIR_BLENDING
|
||||||
float2 screenUV = posInput.positionNDC * _HairBlendingRTHandleScale.xy;
|
float2 screenUV = posInput.positionNDC * _HairBlendingRTHandleScale.xy;
|
||||||
@@ -196,4 +193,4 @@ void Frag(PackedVaryingsToPS packedInput,
|
|||||||
outVTFeedback = builtinData.vtPackedFeedback;
|
outVTFeedback = builtinData.vtPackedFeedback;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user