Added UtsEvaluateBSDF_MatCapDiffuse;

Added UtsEvaluateBSDF_MatCapSpecular;
This commit is contained in:
Misaki
2025-01-24 17:59:40 +09:00
parent 476fdc3774
commit fac66d8694
9 changed files with 307 additions and 299 deletions

View File

@@ -105,10 +105,10 @@ namespace UnityEditor.Rendering.Toon
internal const string ShaderProp_Outline_Sampler = "_Outline_Sampler"; internal const string ShaderProp_Outline_Sampler = "_Outline_Sampler";
internal const string ShaderPropCastHairShadow = "_Is_CastHairShadow"; internal const string ShaderPropCastHairShadow = "_Is_CastHairShadow";
internal const string ShaderPropReceiveHairShadow = "_Is_ReceiveHairShadow"; internal const string ShaderPropReceiveHairShadow = "_Receive_Hair_Shadow";
internal const string ShaderPropEyeParallax = "_Is_EyeParallax"; internal const string ShaderPropEyeParallax = "_Is_EyeParallax";
internal const string ShaderPropHairBlendingTarget = "_Is_HairBlendingTarget"; internal const string ShaderPropHairBlendingTarget = "_HairBlendingTarget";
internal const string ShaderPropSimpleUI = "_simpleUI"; internal const string ShaderPropSimpleUI = "_simpleUI";
internal const string ShaderPropAutoRenderQueue = "_AutoRenderQueue"; internal const string ShaderPropAutoRenderQueue = "_AutoRenderQueue";
@@ -214,10 +214,10 @@ namespace UnityEditor.Rendering.Toon
protected readonly string[] StencilModeNames = { "Off", "Draw If Not Equal to", "Replace Stencil Buffer with" }; protected readonly string[] StencilModeNames = { "Off", "Draw If Not Equal to", "Replace Stencil Buffer with" };
protected readonly string[] ZTestModeNames = { "Disabled", "Never", "Less", "Equal", "LessEqual", "Greater", "NotEqual", "GreaterEqual", "Always" }; protected readonly string[] ZTestModeNames = { "Disabled", "Never", "Less", "Equal", "LessEqual", "Greater", "NotEqual", "GreaterEqual", "Always" };
protected readonly string[] materialTypeDefines = { "MATERIAL_TYPE_STANDARD", "MATERIAL_TYPE_FRONT_HAIR", "MATERIAL_TYPE_FACE", "MATERIAL_TYPE_EYE" }; protected readonly string[] materialTypeDefines = { "_MATERIAL_TYPE_STANDARD", "_MATERIAL_TYPE_FRONTHAIR", "_MATERIAL_TYPE_FACE", "_MATERIAL_TYPE_EYE" };
protected readonly string[] PbrModeDefines = { "PBR_Mode_OFF", "PBR_Mode_ST", "PBR_Mode_ANISO", "PBR_Mode_KK", "PBR_Mode_TOON" }; protected readonly string[] PbrModeDefines = { "_PBR_MODE_OFF", "_PBR_MODE_STANDARD", "_PBR_MODE_ANISOTROPY", "_PBR_MODE_HAIR", "_PBR_MODE_TOON" };
protected readonly string[] IndirectDiffuseModeDefines = { "INDIRECT_DIFFUSE_OFF", "INDIRECT_DIFFUSE_IBL", "INDIRECT_DIFFUSE_MATCAP", "INDIRECT_DIFFUSE_RAMP" }; protected readonly string[] IndirectDiffuseModeDefines = { "_INDIRECT_DIFFUSE_OFF", "_INDIRECT_DIFFUSE_IBL", "_INDIRECT_DIFFUSE_MATCAP", "_INDIRECT_DIFFUSE_RAMP" };
protected readonly string[] IndirectSpecularModeDefines = { "INDIRECT_SPECULAR_OFF", "INDIRECT_SPECULAR_IBL", "INDIRECT_SPECULAR_MATCAP" }; protected readonly string[] IndirectSpecularModeDefines = { "_INDIRECT_SPECULAR_OFF", "_INDIRECT_SPECULAR_IBL", "_INDIRECT_SPECULAR_MATCAP" };
public enum UTS_ClippingMode public enum UTS_ClippingMode
{ {
@@ -334,7 +334,7 @@ namespace UnityEditor.Rendering.Toon
#if UNITY_2021_1_OR_NEWER #if UNITY_2021_1_OR_NEWER
[UTS3InspectorHelpURL("instruction")] [UTS3InspectorHelpURL("instruction")]
#endif // UNITY_2021_1_OR_NEWER #endif // UNITY_2021_1_OR_NEWER
protected enum Expandable protected enum Expandable : uint
{ {
Shader = 1 << 0, Shader = 1 << 0,
Basic = 1 << 1, Basic = 1 << 1,
@@ -672,7 +672,8 @@ namespace UnityEditor.Rendering.Toon
public static readonly GUIContent hairBlendingTargetMapText = new GUIContent("Blending Map", "Specifies the texture to blend with hair."); public static readonly GUIContent hairBlendingTargetMapText = new GUIContent("Blending Map", "Specifies the texture to blend with hair.");
public static readonly GUIContent normalMapText = new GUIContent("Normal Map", "A texture that dictates the bumpiness of the material."); public static readonly GUIContent normalMapText = new GUIContent("Normal Map", "A texture that dictates the bumpiness of the material.");
public static readonly GUIContent pbrModeText = new GUIContent("PBR Mode", "Specifies PBR model mode."); public static readonly GUIContent pbrModeText = new GUIContent("PBR Mode", "Specifies PBR model mode.");
public static readonly GUIContent ambientModeModeText = new GUIContent("Ambient Mode", "Specifies ambient calculation mode."); public static readonly GUIContent indirectDiffuseModeText = new GUIContent("Indirect Diffuse Mode", "Specifies indirect diffuse mode.");
public static readonly GUIContent indirectSpecularText = new GUIContent("Indirect Specular Mode", "Specifies indirect specular mode.");
public static readonly GUIContent highColorText = new GUIContent("Highlight", "Highlight : Texture(sRGB) x Color(RGB) Default:White"); public static readonly GUIContent highColorText = new GUIContent("Highlight", "Highlight : Texture(sRGB) x Color(RGB) Default:White");
public static readonly GUIContent highColorMaskText = new GUIContent("Highlight Mask", "A grayscale texture which utilizes its brightness to control intensity."); public static readonly GUIContent highColorMaskText = new GUIContent("Highlight Mask", "A grayscale texture which utilizes its brightness to control intensity.");
public static readonly GUIContent rimLightMaskText = new GUIContent("Rim Light Mask", "Rim Light Mask : Texture(linear). The white part of the texture is displayed as Rim Light, and the black part is masked and not displayed."); public static readonly GUIContent rimLightMaskText = new GUIContent("Rim Light Mask", "Rim Light Mask : Texture(linear). The white part of the texture is displayed as Rim Light, and the black part is masked and not displayed.");
@@ -1638,7 +1639,7 @@ namespace UnityEditor.Rendering.Toon
var isReceiveHairShadowEnabled = GUI_Toggle(material, Styles.receiveHairShadowText, ShaderPropReceiveHairShadow, var isReceiveHairShadowEnabled = GUI_Toggle(material, Styles.receiveHairShadowText, ShaderPropReceiveHairShadow,
MaterialGetInt(material, ShaderPropReceiveHairShadow) != 0); MaterialGetInt(material, ShaderPropReceiveHairShadow) != 0);
material.SetKeyword(new LocalKeyword(material.shader, "_RECEIVE_HAIR_SHADOW"), isReceiveHairShadowEnabled); material.SetKeyword(new LocalKeyword(material.shader, "_RECEIVE_HAIR_SHADOW_ON"), isReceiveHairShadowEnabled);
var isHairBlendingTargetEnabled = GUI_Toggle(material, Styles.hairBlendingTargetShadowText, ShaderPropHairBlendingTarget, var isHairBlendingTargetEnabled = GUI_Toggle(material, Styles.hairBlendingTargetShadowText, ShaderPropHairBlendingTarget,
MaterialGetInt(material, ShaderPropHairBlendingTarget) != 0); MaterialGetInt(material, ShaderPropHairBlendingTarget) != 0);
@@ -1817,13 +1818,13 @@ namespace UnityEditor.Rendering.Toon
void GUI_AmbientMode(Material material) void GUI_AmbientMode(Material material)
{ {
m_IndirectDiffuseMode = (IndirectDiffuseMode)MaterialGetInt(material, ShaderPropIDMode); m_IndirectDiffuseMode = (IndirectDiffuseMode)MaterialGetInt(material, ShaderPropIDMode);
m_IndirectDiffuseMode = (IndirectDiffuseMode)EditorGUILayout.EnumPopup(Styles.ambientModeModeText, m_IndirectDiffuseMode); m_IndirectDiffuseMode = (IndirectDiffuseMode)EditorGUILayout.EnumPopup(Styles.indirectDiffuseModeText, m_IndirectDiffuseMode);
material.SetFloat(ShaderPropIDMode, (int)m_IndirectDiffuseMode); material.SetFloat(ShaderPropIDMode, (int)m_IndirectDiffuseMode);
SwitchKeywrod(material, IndirectDiffuseModeDefines[(int)m_IndirectDiffuseMode], IndirectDiffuseModeDefines); SwitchKeywrod(material, IndirectDiffuseModeDefines[(int)m_IndirectDiffuseMode], IndirectDiffuseModeDefines);
m_IndirectSpecularMode = (IndirectSpecularMode)MaterialGetInt(material, ShaderPropISMode); m_IndirectSpecularMode = (IndirectSpecularMode)MaterialGetInt(material, ShaderPropISMode);
m_IndirectSpecularMode = (IndirectSpecularMode)EditorGUILayout.EnumPopup(Styles.ambientModeModeText, m_IndirectSpecularMode); m_IndirectSpecularMode = (IndirectSpecularMode)EditorGUILayout.EnumPopup(Styles.indirectSpecularText, m_IndirectSpecularMode);
material.SetFloat(ShaderPropISMode, (int)m_IndirectSpecularMode); material.SetFloat(ShaderPropISMode, (int)m_IndirectSpecularMode);
SwitchKeywrod(material, IndirectSpecularModeDefines[(int)m_IndirectSpecularMode], IndirectSpecularModeDefines); SwitchKeywrod(material, IndirectSpecularModeDefines[(int)m_IndirectSpecularMode], IndirectSpecularModeDefines);

View File

@@ -1448,6 +1448,6 @@ Shader "HDRP/Toon"
} }
} }
//CustomEditor "UnityEditor.Rendering.Toon.UTS3GUI" CustomEditor "UnityEditor.Rendering.Toon.UTS3GUI"
CustomEditor "Misaki.HdrpToon.Editor.UTSShaderGUI" //CustomEditor "Misaki.HdrpToon.Editor.UTSShaderGUI"
} }

View File

@@ -34,8 +34,85 @@ float3 GetSmoothedWorldNormal(float2 uv, float3x3 t_tbn)
return mul(normal, t_tbn); return mul(normal, t_tbn);
} }
float3 UtsComputeDiffuseColor(float3 baseColor, float metallic, float min)
{
#if _PBR_MODE_OFF
return baseColor;
#else
return baseColor * (max(min, 1.0 - metallic));
#endif
}
float3 UtsComputeDiffuseColor(float3 baseColor, float metallic)
{
return UtsComputeDiffuseColor(baseColor, metallic, 0.0);
}
#define SampleRampSignalLine(texture, u) (SAMPLE_TEXTURE2D_LOD(texture, s_linear_clamp_sampler, float2(u, 0.5), 0)) #define SampleRampSignalLine(texture, u) (SAMPLE_TEXTURE2D_LOD(texture, s_linear_clamp_sampler, float2(u, 0.5), 0))
// Exposure
float3 ApplyCurrentExposureMultiplier(float3 color)
{
return color * lerp(GetCurrentExposureMultiplier(), 1, _ToonIgnoreExposureMultiplier);
}
float3 ConvertFromEV100(float3 EV100)
{
float3 value = pow(2, EV100) * 2.5f;
return value;
}
float3 ConvertToEV100(float3 value)
{
return log2(value * 0.4f);
}
float WeightSample(PositionInputs positionInput)
{
// Center-weighted
const float2 kCenter = _ScreenParams.xy * 0.5;
const float weight = pow(length((kCenter.xy - positionInput.positionSS.xy) / _ScreenParams.xy), 1.0);
return 1.0 - saturate(weight);
}
float3 ApplyCompensation(float3 originalColor)
{
float3 ev100_Color = ConvertToEV100(originalColor) + _ToonEvAdjustmentCompensation * 0.5f;
float3 resultColor = max(0, ConvertFromEV100(ev100_Color));
return resultColor;
}
float3 GetExposureAdjustedColor(float3 originalColor)
{
if (_ToonEvAdjustmentCurve != 0)
{
float3 ev100_Color = ConvertToEV100(originalColor);
ev100_Color = clamp(ev100_Color, _ToonEvAdjustmentValueMin, _ToonEvAdjustmentValueMax);
float3 ev100_remap = (ev100_Color - _ToonEvAdjustmentValueMin) * (128 - 1) / (_ToonEvAdjustmentValueMax - _ToonEvAdjustmentValueMin);
ev100_remap = clamp(ev100_remap, 0.0, 127.0);
int3 ev100_idx = (int3)ev100_remap;
float3 ev100_lerp = ev100_remap - ev100_idx;
float3 ev100_remapped;
ev100_remapped.r = _ToonEvAdjustmentValueArray[ev100_idx.r] + (_ToonEvAdjustmentValueArray[ev100_idx.r + 1] - _ToonEvAdjustmentValueArray[ev100_idx.r]) * ev100_lerp.r;
ev100_remapped.g = _ToonEvAdjustmentValueArray[ev100_idx.g] + (_ToonEvAdjustmentValueArray[ev100_idx.g + 1] - _ToonEvAdjustmentValueArray[ev100_idx.g]) * ev100_lerp.g;
ev100_remapped.b = _ToonEvAdjustmentValueArray[ev100_idx.b] + (_ToonEvAdjustmentValueArray[ev100_idx.b + 1] - _ToonEvAdjustmentValueArray[ev100_idx.b]) * ev100_lerp.b;
float3 resultColor = ConvertFromEV100(ev100_remapped);
return resultColor;
}
else // else is neccessary to avoid warrnings.
{
return originalColor;
}
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Transform // Transform
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -5,7 +5,7 @@
#ifndef UCTS_HDRP_INCLUDED #ifndef UCTS_HDRP_INCLUDED
#define UCTS_HDRP_INCLUDED #define UCTS_HDRP_INCLUDED
#define UCTS_HDRP 1 #include "Packages/com.misaki.hdrp-toon/Runtime/HDRP/Shaders/Includes/Common/UtsCommon.hlsl"
#define UTS_LAYER_VISIBILITY #define UTS_LAYER_VISIBILITY
@@ -202,18 +202,25 @@ UtsBSDFData ConvertUTSSurfaceDataToUTSBSDFData(UTSSurfaceData surfaceData)
output.materialFeatures = surfaceData.materialFeatures; output.materialFeatures = surfaceData.materialFeatures;
float albedoIntensity = max(0.1, (1 - sqrt(surfaceData.metallic)) * (1.7 - 0.7 * (1 - sqrt(surfaceData.metallic)))); output.diffuseColor = UtsComputeDiffuseColor(surfaceData.baseColor, surfaceData.metallic, 0.05);
output.diffuseColor = albedoIntensity * surfaceData.baseColor; output.firstShadingDiffuseColor = UtsComputeDiffuseColor(surfaceData.firstShadingColor, surfaceData.metallic, 0.05);
output.firstShadingDiffuseColor = albedoIntensity * surfaceData.firstShadingColor; output.secondShadingDiffuseColor = UtsComputeDiffuseColor(surfaceData.secondShadingColor, surfaceData.metallic, 0.05);
output.secondShadingDiffuseColor = albedoIntensity * surfaceData.secondShadingColor;
#if _PBR_MODE_OFF
output.fresnel0 = surfaceData.baseColor;
#else
output.fresnel0 = ComputeFresnel0(surfaceData.baseColor, surfaceData.metallic, 0.22); output.fresnel0 = ComputeFresnel0(surfaceData.baseColor, surfaceData.metallic, 0.22);
#endif
output.fresnel90 = ComputeF90(output.fresnel0); output.fresnel90 = ComputeF90(output.fresnel0);
output.reflectivity = (1.0 - 0.22) * (1 - surfaceData.metallic); output.reflectivity = (1.0 - 0.22) * (1 - surfaceData.metallic);
output.ambientOcclusion = surfaceData.ambientOcclusion; output.ambientOcclusion = surfaceData.ambientOcclusion;
output.specularOcclusion = surfaceData.specularOcclusion; output.specularOcclusion = surfaceData.specularOcclusion;
#if _PBR_MODE_OFF
output.perceptualRoughness = 0.0;
#else
output.perceptualRoughness = PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness); output.perceptualRoughness = PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness);
#endif
output.subsurfaceColor = surfaceData.subsurfaceColor * surfaceData.subsurfaceMask; output.subsurfaceColor = surfaceData.subsurfaceColor * surfaceData.subsurfaceMask;
@@ -242,10 +249,12 @@ PreLightData GetPreLightData_UTS(float3 V, PositionInputs posInput, inout UtsBSD
// Handle IBL + area light + multiscattering. // Handle IBL + area light + multiscattering.
// Note: use the not modified by anisotropy iblPerceptualRoughness here. // Note: use the not modified by anisotropy iblPerceptualRoughness here.
float specularReflectivity; float specularReflectivity = 1.0;
GetPreIntegratedFGDGGXAndDisneyDiffuse(clampedNdotV, preLightData.iblPerceptualRoughness, bsdfData.fresnel0, bsdfData.fresnel90, preLightData.specularFGD, preLightData.diffuseFGD, specularReflectivity); #if _PBR_MODE_OFF
#ifdef USE_DIFFUSE_LAMBERT_BRDF
preLightData.diffuseFGD = 1.0; preLightData.diffuseFGD = 1.0;
preLightData.specularFGD = 1.0;
#else
GetPreIntegratedFGDGGXAndDisneyDiffuse(clampedNdotV, preLightData.iblPerceptualRoughness, bsdfData.fresnel0, bsdfData.fresnel90, preLightData.specularFGD, preLightData.diffuseFGD, specularReflectivity);
#endif #endif
#ifdef LIT_USE_GGX_ENERGY_COMPENSATION #ifdef LIT_USE_GGX_ENERGY_COMPENSATION
@@ -262,10 +271,7 @@ PreLightData GetPreLightData_UTS(float3 V, PositionInputs posInput, inout UtsBSD
float3 iblN; float3 iblN;
// We avoid divergent evaluation of the GGX, as that nearly doubles the cost. #if _PBR_MODE_ANISOTROPY
// If the tile has anisotropy, all the pixels within the tile are evaluated as anisotropic.
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_ANISOTROPY))
{
float TdotV = dot(bsdfData.tangentWS, V); float TdotV = dot(bsdfData.tangentWS, V);
float BdotV = dot(bsdfData.bitangentWS, V); float BdotV = dot(bsdfData.bitangentWS, V);
@@ -273,12 +279,10 @@ PreLightData GetPreLightData_UTS(float3 V, PositionInputs posInput, inout UtsBSD
// perceptualRoughness is use as input and output here // perceptualRoughness is use as input and output here
GetGGXAnisotropicModifiedNormalAndRoughness(bsdfData.bitangentWS, bsdfData.tangentWS, N, V, bsdfData.anisotropy, preLightData.iblPerceptualRoughness, iblN, preLightData.iblPerceptualRoughness); GetGGXAnisotropicModifiedNormalAndRoughness(bsdfData.bitangentWS, bsdfData.tangentWS, N, V, bsdfData.anisotropy, preLightData.iblPerceptualRoughness, iblN, preLightData.iblPerceptualRoughness);
} #else
else
{
preLightData.partLambdaV = GetSmithJointGGXPartLambdaV(clampedNdotV, bsdfData.roughnessT); preLightData.partLambdaV = GetSmithJointGGXPartLambdaV(clampedNdotV, bsdfData.roughnessT);
iblN = N; iblN = N;
} #endif
preLightData.iblR = reflect(-V, iblN); preLightData.iblR = reflect(-V, iblN);
@@ -305,22 +309,9 @@ PreLightData GetPreLightData_UTS(float3 V, PositionInputs posInput, inout UtsBSD
preLightData.ltcTransformCoat = SampleLtcMatrix(CLEAR_COAT_PERCEPTUAL_ROUGHNESS, clampedNdotV, LTCLIGHTINGMODEL_GGX); preLightData.ltcTransformCoat = SampleLtcMatrix(CLEAR_COAT_PERCEPTUAL_ROUGHNESS, clampedNdotV, LTCLIGHTINGMODEL_GGX);
} }
// refraction (forward only)
#if HAS_REFRACTION
RefractionModelResult refraction = REFRACTION_MODEL(V, posInput, bsdfData);
preLightData.transparentRefractV = refraction.rayWS;
preLightData.transparentPositionWS = refraction.positionWS;
preLightData.transparentTransmittance = exp(-bsdfData.absorptionCoefficient * refraction.dist);
// Empirical remap to try to match a bit the refraction probe blurring for the fallback
// Use IblPerceptualRoughness so we can handle approx of clear coat.
preLightData.transparentSSMipLevel = PositivePow(preLightData.iblPerceptualRoughness, 1.3) * uint(max(_ColorPyramidLodCount - 1, 0));
#endif
return preLightData; return preLightData;
} }
// Legacy for compatibility with existing shaders // Legacy for compatibility with existing shaders
inline bool IsGammaSpace() inline bool IsGammaSpace()
{ {

View File

@@ -19,7 +19,7 @@ float StepFeatherToon(float value,float step,float feather)
return saturate((value - step + feather) / feather); return saturate((value - step + feather) / feather);
} }
float3 ComputeSpecularTerm(float3 V, float3 L, UtsBSDFData bsdfData) float3 ComputeSpecularTerm(UtsBSDFData bsdfData, PreLightData preLightData, float3 V, float3 L)
{ {
#ifdef _PBR_MODE_OFF #ifdef _PBR_MODE_OFF
return 0; return 0;
@@ -29,16 +29,9 @@ float3 ComputeSpecularTerm(float3 V, float3 L, UtsBSDFData bsdfData)
float3 H = normalize(L + V); float3 H = normalize(L + V);
float NdotL = dot(N, L); float NdotL = dot(N, L);
float NdotV = dot(N, V);
float clampedNdotV = ClampNdotV(NdotV);
float clampedNdotL = saturate(NdotL);
float flippedNdotL = ComputeWrappedDiffuseLighting(-NdotL, TRANSMISSION_WRAP_LIGHT);
float diffuseNdotL = clampedNdotL;
float LdotV = dot(L, V);
float NdotH = saturate(dot(N, H)); float NdotH = saturate(dot(N, H));
float HdotL = saturate(dot(H, L)); float clampedNdotV = ClampNdotV(preLightData.NdotV);
float clampedNdotL = saturate(NdotL);
float3 F = F_Schlick(bsdfData.fresnel0, bsdfData.fresnel90, HdotL);
float partLambdaV; float partLambdaV;
float3 DV = 0; float3 DV = 0;
@@ -73,12 +66,14 @@ float3 ComputeSpecularTerm(float3 V, float3 L, UtsBSDFData bsdfData)
DV = DV * normalizeSpec * _KKColor.rgb; DV = DV * normalizeSpec * _KKColor.rgb;
#elif _PBR_MODE_TOON #elif _PBR_MODE_TOON
float specularExponent = RoughnessToBlinnPhongSpecularExponent(PerceptualRoughnessToRoughness(bsdfData.perceptualRoughness)); float specularExponent = RoughnessToBlinnPhongSpecularExponent(PerceptualRoughnessToRoughness(bsdfData.perceptualRoughness));
specTerm = pow(NdotH, 5.0 * specularExponent); DV = pow(NdotH, 5.0 * specularExponent);
specTerm = StepFeatherToon(specTerm, _ToonSpecularStep, _ToonSpecularFeather); DV = StepFeatherToon(DV, _ToonSpecularStep, _ToonSpecularFeather);
return specTerm * ColorSpaceDielectricSpec.rgb * clampedNdotL; //specTerm = pow(NdotH, 5.0 * specularExponent);
//specTerm = StepFeatherToon(specTerm, _ToonSpecularStep, _ToonSpecularFeather);
//return specTerm * ColorSpaceDielectricSpec.rgb * clampedNdotL;
#endif #endif
specTerm = DV * F; specTerm = DV * preLightData.specularFGD;
specTerm = specTerm * clampedNdotL; specTerm = specTerm * clampedNdotL;
return specTerm; return specTerm;

View File

@@ -11,15 +11,6 @@
#define APPLY_WEIGHT(x, y, t) lerp(x, x * y, t) #define APPLY_WEIGHT(x, y, t) lerp(x, x * y, t)
// not in materials
int _ToonLightHiCutFilter;
int _ToonEvAdjustmentCurve;
float _ToonEvAdjustmentValueArray[128];
float _ToonEvAdjustmentValueMin;
float _ToonEvAdjustmentValueMax;
float _ToonEvAdjustmentCompensation;
float _ToonIgnoreExposureMultiplier;
struct UTSLightData struct UTSLightData
{ {
float3 lightDirection; float3 lightDirection;
@@ -31,75 +22,6 @@ struct UTSLightData
SHADOW_TYPE shadowValue; SHADOW_TYPE shadowValue;
}; };
float3 ApplyCurrentExposureMultiplier(float3 color)
{
return color * lerp(GetCurrentExposureMultiplier(), 1, _ToonIgnoreExposureMultiplier);
}
float3 AccumulateUTSAggregateLighting(AggregateLighting aggregateLighting, UtsBSDFData bsdfData)
{
float3 directLighting = aggregateLighting.direct.diffuse + aggregateLighting.direct.specular;
float3 indirectLighting = ApplyCurrentExposureMultiplier(aggregateLighting.indirect.specularReflected * bsdfData.fresnel0 * _IR_Intensity + aggregateLighting.indirect.specularTransmitted * bsdfData.diffuseColor * _ID_Intensity);
return SATURATE_IF_SDR(directLighting + indirectLighting);
}
float3 ConvertFromEV100(float3 EV100)
{
float3 value = pow(2, EV100) * 2.5f;
return value;
}
float3 ConvertToEV100(float3 value)
{
return log2(value * 0.4f);
}
float WeightSample(PositionInputs positionInput)
{
// Center-weighted
const float2 kCenter = _ScreenParams.xy * 0.5;
const float weight = pow(length((kCenter.xy - positionInput.positionSS.xy) / _ScreenParams.xy), 1.0);
return 1.0 - saturate(weight);
}
float3 ApplyCompensation(float3 originalColor)
{
float3 ev100_Color = ConvertToEV100(originalColor) + _ToonEvAdjustmentCompensation * 0.5f;
float3 resultColor = max(0, ConvertFromEV100(ev100_Color));
return resultColor;
}
float3 GetExposureAdjustedColor(float3 originalColor)
{
if (_ToonEvAdjustmentCurve != 0)
{
float3 ev100_Color = ConvertToEV100(originalColor);
ev100_Color = clamp(ev100_Color, _ToonEvAdjustmentValueMin, _ToonEvAdjustmentValueMax);
float3 ev100_remap = (ev100_Color - _ToonEvAdjustmentValueMin) * (128 - 1) / (_ToonEvAdjustmentValueMax - _ToonEvAdjustmentValueMin);
ev100_remap = clamp(ev100_remap, 0.0, 127.0);
int3 ev100_idx = (int3) ev100_remap;
float3 ev100_lerp = ev100_remap - ev100_idx;
float3 ev100_remapped;
ev100_remapped.r = _ToonEvAdjustmentValueArray[ev100_idx.r] + (_ToonEvAdjustmentValueArray[ev100_idx.r + 1] - _ToonEvAdjustmentValueArray[ev100_idx.r]) * ev100_lerp.r;
ev100_remapped.g = _ToonEvAdjustmentValueArray[ev100_idx.g] + (_ToonEvAdjustmentValueArray[ev100_idx.g + 1] - _ToonEvAdjustmentValueArray[ev100_idx.g]) * ev100_lerp.g;
ev100_remapped.b = _ToonEvAdjustmentValueArray[ev100_idx.b] + (_ToonEvAdjustmentValueArray[ev100_idx.b + 1] - _ToonEvAdjustmentValueArray[ev100_idx.b]) * ev100_lerp.b;
float3 resultColor = ConvertFromEV100(ev100_remapped);
return resultColor;
}
else // else is neccessary to avoid warrnings.
{
return originalColor;
}
}
float GetLightAttenuation(float3 lightColor) float GetLightAttenuation(float3 lightColor)
{ {
float lightAttenuation = rateR * lightColor.r + rateG * lightColor.g + rateB * lightColor.b; float lightAttenuation = rateR * lightColor.r + rateG * lightColor.g + rateB * lightColor.b;
@@ -114,6 +36,41 @@ float3 GetLimitedLightColor(float3 lightColor)
return result; return result;
} }
DirectLighting UtsEvaluateShading_Directional(LightLoopContext lightLoopContext, PositionInputs posInput, BuiltinData builtinData, DirectionalLightData lightData, UtsBSDFData bsdfData, PreLightData preLightData, float3 V)
{
DirectLighting lighting;
ZERO_INITIALIZE(DirectLighting, lighting);
float3 L = -lightData.forward;
float NdotL = dot(bsdfData.normalWS, L);
float halfLambert = 0.5 * NdotL + 0.5;
SHADOW_TYPE shadow = EvaluateShadow_Directional(lightLoopContext, posInput, lightData, builtinData, bsdfData.normalWS);
float systemShadows = saturate(shadow + 0.5f + _Tweak_SystemShadowsLevel > 0.0 ? shadow + 0.5f + _Tweak_SystemShadowsLevel : 0.0);
float shadingGrade = lerp(halfLambert, halfLambert * systemShadows, _Set_SystemShadowsToBase);
float firstColorFeatherForMask = lerp(_1st_ShadeColor_Feather, 0.0f, max(_ComposerMaskMode, _FirstShadeOverridden));
float finalShadow = saturate((shadingGrade - (_1st_ShadeColor_Step - firstColorFeatherForMask)) / (_1st_ShadeColor_Step - (_1st_ShadeColor_Step - firstColorFeatherForMask))); // Base and 1st Shade Mask
if (lightData.diffuseDimmer > 0.0 && finalShadow > 0.0)
{
float secondColorFeatherForMask = lerp(_2nd_ShadeColor_Feather, 0.0f, max(_SecondShadeOverridden, _ComposerMaskMode));
float shadeShadow = saturate((halfLambert - (_ShadeColor_Step - secondColorFeatherForMask)) / (_ShadeColor_Step - (_ShadeColor_Step - secondColorFeatherForMask))); // 1st and 2nd Shades Mask
float3 diffuseTerm = lerp(lerp(bsdfData.secondShadingDiffuseColor, bsdfData.firstShadingDiffuseColor, shadeShadow), bsdfData.diffuseColor, finalShadow);
float3 specularTerm = ComputeSpecularTerm(bsdfData, preLightData, V, L) * finalShadow;
float4 lightColor = EvaluateLight_Directional(lightLoopContext, posInput, lightData);
lightColor.rgb *= ComputeShadowColor(systemShadows, lightData.shadowTint, lightData.penumbraTint) * lightColor.a * _Light_Intensity_Multiplier;
lightColor.rgb = GetLimitedLightColor(lightColor.rgb);
lighting.diffuse = diffuseTerm * lightColor.rgb * lightData.diffuseDimmer;
lighting.specular += specularTerm * lightColor.rgb * lightData.specularDimmer;
}
return lighting;
}
IndirectLighting UtsEvaluateBSDF_ScreenSpaceReflection(PositionInputs posInput, PreLightData preLightData, inout float reflectionHierarchyWeight) IndirectLighting UtsEvaluateBSDF_ScreenSpaceReflection(PositionInputs posInput, PreLightData preLightData, inout float reflectionHierarchyWeight)
{ {
IndirectLighting lighting; IndirectLighting lighting;
@@ -175,9 +132,25 @@ void UtsEvaluateBSDF_BakeDiffuse(PositionInputs posInput, PreLightData preLightD
} }
} }
void UtsEvaluateMatCap(PositionInputs posInput, UtsBSDFData bsdfData, float perceptualRoughness, inout BuiltinData builtinData) void UtsEvaluateBSDF_MatCapDiffuse(float3 positionWS, float3 normalWS, inout BuiltinData builtinData)
{ {
float3 positionVS = mul(UNITY_MATRIX_V, float4(posInput.positionWS, 1.0)).xyz; float3 positionVS = mul(UNITY_MATRIX_V, float4(positionWS, 1.0)).xyz;
float3 normalVS = mul(UNITY_MATRIX_V, float4(normalWS, 1.0)).xyz;
float3 PcrossN = cross(normalize(positionVS), normalVS);
float2 uv = PcrossN.yx;
uv.x *= -1;
uv = uv * 0.5 + 0.5;
builtinData.bakeDiffuseLighting = SAMPLE_TEXTURE2D_LOD(_MatCapMap, s_linear_clamp_sampler, uv, UNITY_SPECCUBE_LOD_STEPS).rgb * GetInverseCurrentExposureMultiplier();
}
IndirectLighting UtsEvaluateBSDF_MatCapSpecular(float3 positionWS, UtsBSDFData bsdfData, PreLightData preLightData)
{
IndirectLighting lighting;
ZERO_INITIALIZE(IndirectLighting, lighting);
float3 positionVS = mul(UNITY_MATRIX_V, float4(positionWS, 1.0)).xyz;
float3 normalVS = mul(UNITY_MATRIX_V, float4(bsdfData.normalWS, 1.0)).xyz; float3 normalVS = mul(UNITY_MATRIX_V, float4(bsdfData.normalWS, 1.0)).xyz;
float3 PcrossN = cross(normalize(positionVS), normalVS); float3 PcrossN = cross(normalize(positionVS), normalVS);
@@ -185,12 +158,15 @@ void UtsEvaluateMatCap(PositionInputs posInput, UtsBSDFData bsdfData, float perc
uv.x *= -1; uv.x *= -1;
uv = uv * 0.5 + 0.5; uv = uv * 0.5 + 0.5;
builtinData.bakeDiffuseLighting = SAMPLE_TEXTURE2D_LOD(_MatCapMap, s_linear_clamp_sampler, uv, PerceptualRoughnessToMipmapLevel(perceptualRoughness)).rgb * GetInverseCurrentExposureMultiplier(); lighting.specularReflected = SAMPLE_TEXTURE2D_LOD(_MatCapMap, s_linear_clamp_sampler, uv, PerceptualRoughnessToMipmapLevel(bsdfData.perceptualRoughness)).rgb;
lighting.specularReflected *= preLightData.specularFGD * GetInverseCurrentExposureMultiplier();
return lighting;
} }
void UtsEvaluateRamp(PositionInputs posInput, UtsBSDFData bsdfData, inout BuiltinData builtinData) void UtsEvaluateBSDF_Ramp(PositionInputs posInput, UtsBSDFData bsdfData, float3 L, inout BuiltinData builtinData)
{ {
// TODO
} }
IndirectLighting UtsEvaluateBSDF_Env(LightLoopContext lightLoopContext, PositionInputs posInput, PreLightData preLightData, EnvLightData lightData, UtsBSDFData bsdfData, int influenceShapeType, int GPUImageBasedLightingType, inout float hierarchyWeight) IndirectLighting UtsEvaluateBSDF_Env(LightLoopContext lightLoopContext, PositionInputs posInput, PreLightData preLightData, EnvLightData lightData, UtsBSDFData bsdfData, int influenceShapeType, int GPUImageBasedLightingType, inout float hierarchyWeight)
@@ -220,15 +196,6 @@ IndirectLighting UtsEvaluateBSDF_Env(LightLoopContext lightLoopContext, Position
// Note: using influenceShapeType and projectionShapeType instead of (lightData|proxyData).shapeType allow to make compiler optimization in case the type is know (like for sky) // Note: using influenceShapeType and projectionShapeType instead of (lightData|proxyData).shapeType allow to make compiler optimization in case the type is know (like for sky)
float intersectionDistance = EvaluateLight_EnvIntersection(positionWS, bsdfData.normalWS, lightData, influenceShapeType, R, weight); float intersectionDistance = EvaluateLight_EnvIntersection(positionWS, bsdfData.normalWS, lightData, influenceShapeType, R, weight);
// Don't do clear coating for refraction
float3 coatR = preLightData.coatIblR;
if (GPUImageBasedLightingType == GPUIMAGEBASEDLIGHTINGTYPE_REFLECTION && HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_CLEAR_COAT))
{
float unusedWeight = 0.0;
EvaluateLight_EnvIntersection(positionWS, bsdfData.normalWS, lightData, influenceShapeType, coatR, unusedWeight);
}
float3 F = preLightData.specularFGD; float3 F = preLightData.specularFGD;
float4 preLD = SampleEnvWithDistanceBaseRoughness(lightLoopContext, posInput, lightData, R, preLightData.iblPerceptualRoughness, intersectionDistance); float4 preLD = SampleEnvWithDistanceBaseRoughness(lightLoopContext, posInput, lightData, R, preLightData.iblPerceptualRoughness, intersectionDistance);
@@ -252,41 +219,6 @@ IndirectLighting UtsEvaluateBSDF_Env(LightLoopContext lightLoopContext, Position
return lighting; return lighting;
} }
DirectLighting UtsEvaluateShading_Directional(LightLoopContext lightLoopContext, PositionInputs posInput, BuiltinData builtinData, DirectionalLightData lightData, UtsBSDFData bsdfData, float3 V)
{
DirectLighting lighting;
ZERO_INITIALIZE(DirectLighting, lighting);
float3 L = - lightData.forward;
float NdotL = dot(bsdfData.normalWS, L);
float halfLambert = 0.5 * NdotL + 0.5;
SHADOW_TYPE shadow = EvaluateShadow_Directional(lightLoopContext, posInput, lightData, builtinData, bsdfData.normalWS);
float systemShadows = saturate(shadow + 0.5f + _Tweak_SystemShadowsLevel > 0.0 ? shadow + 0.5f + _Tweak_SystemShadowsLevel : 0.0);
float shadingGrade = lerp(halfLambert, halfLambert * systemShadows, _Set_SystemShadowsToBase );
float firstColorFeatherForMask = lerp(_1st_ShadeColor_Feather, 0.0f, max(_ComposerMaskMode, _FirstShadeOverridden));
float finalShadow = saturate((shadingGrade - (_1st_ShadeColor_Step - firstColorFeatherForMask)) / (_1st_ShadeColor_Step - (_1st_ShadeColor_Step - firstColorFeatherForMask))); // Base and 1st Shade Mask
if (lightData.diffuseDimmer > 0.0 && finalShadow > 0.0)
{
float secondColorFeatherForMask = lerp(_2nd_ShadeColor_Feather, 0.0f, max(_SecondShadeOverridden, _ComposerMaskMode));
float shadeShadow = saturate((halfLambert - (_ShadeColor_Step - secondColorFeatherForMask)) / (_ShadeColor_Step - (_ShadeColor_Step - secondColorFeatherForMask))); // 1st and 2nd Shades Mask
float3 diffuseTerm = lerp(lerp(bsdfData.secondShadingDiffuseColor, bsdfData.firstShadingDiffuseColor, shadeShadow), bsdfData.diffuseColor, finalShadow);
float3 specularTerm = ComputeSpecularTerm(V, L, bsdfData) * finalShadow;
float4 lightColor = EvaluateLight_Directional(lightLoopContext, posInput, lightData);
lightColor.rgb *= ComputeShadowColor(systemShadows, lightData.shadowTint, lightData.penumbraTint) * lightColor.a * _Light_Intensity_Multiplier;
lightColor.rgb = GetLimitedLightColor(lightColor.rgb);
lighting.diffuse = diffuseTerm * lightColor.rgb * lightData.diffuseDimmer;
lighting.specular += specularTerm * lightColor.rgb * lightData.specularDimmer;
}
return lighting;
}
void UtsPostEvaluateBSDF(PositionInputs posInput, PreLightData preLightData, UtsBSDFData bsdfData, BuiltinData builtinData, AggregateLighting lighting, out LightLoopOutput lightLoopOutput) void UtsPostEvaluateBSDF(PositionInputs posInput, PreLightData preLightData, UtsBSDFData bsdfData, BuiltinData builtinData, AggregateLighting lighting, out LightLoopOutput lightLoopOutput)
{ {
AmbientOcclusionFactor aoFactor; AmbientOcclusionFactor aoFactor;
@@ -296,7 +228,7 @@ void UtsPostEvaluateBSDF(PositionInputs posInput, PreLightData preLightData, Uts
lighting.direct.diffuse = APPLY_WEIGHT(lighting.direct.diffuse, aoFactor.directAmbientOcclusion, _AO_Factor); lighting.direct.diffuse = APPLY_WEIGHT(lighting.direct.diffuse, aoFactor.directAmbientOcclusion, _AO_Factor);
lighting.direct.specular = APPLY_WEIGHT(lighting.direct.specular, aoFactor.directSpecularOcclusion, _AO_Factor); lighting.direct.specular = APPLY_WEIGHT(lighting.direct.specular, aoFactor.directSpecularOcclusion, _AO_Factor);
builtinData.bakeDiffuseLighting = ApplyCurrentExposureMultiplier(builtinData.bakeDiffuseLighting * bsdfData.diffuseColor * _ID_Intensity); builtinData.bakeDiffuseLighting = ApplyCurrentExposureMultiplier(builtinData.bakeDiffuseLighting * bsdfData.diffuseColor * preLightData.diffuseFGD * _ID_Intensity);
lighting.indirect.specularReflected = ApplyCurrentExposureMultiplier(lighting.indirect.specularReflected * bsdfData.fresnel0 * _IR_Intensity); lighting.indirect.specularReflected = ApplyCurrentExposureMultiplier(lighting.indirect.specularReflected * bsdfData.fresnel0 * _IR_Intensity);
lightLoopOutput.diffuseLighting = lighting.direct.diffuse + builtinData.bakeDiffuseLighting + builtinData.emissiveColor; lightLoopOutput.diffuseLighting = lighting.direct.diffuse + builtinData.bakeDiffuseLighting + builtinData.emissiveColor;

View File

@@ -128,6 +128,19 @@ void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bs
} }
} }
if (featureFlags & LIGHTFEATUREFLAGS_DIRECTIONAL)
{
uint i = 0; // Declare once to avoid the D3D11 compiler warning.
for (i = 0; i < _DirectionalLightCount; ++i)
{
if (IsMatchingLightLayer(_DirectionalLightDatas[i].lightLayers, builtinData.renderingLayers))
{
DirectLighting direct = UtsEvaluateShading_Directional(context, posInput, builtinData, _DirectionalLightDatas[i], bsdfData, preLightData, V);
AccumulateDirectLighting(direct, aggregateLighting);
}
}
}
if (featureFlags & (LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_SSREFRACTION | LIGHTFEATUREFLAGS_SSREFLECTION)) if (featureFlags & (LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_SSREFRACTION | LIGHTFEATUREFLAGS_SSREFLECTION))
{ {
float reflectionHierarchyWeight = 0.0; // Max: 1.0 float reflectionHierarchyWeight = 0.0; // Max: 1.0
@@ -161,7 +174,7 @@ void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bs
} }
#endif #endif
float3 lightInReflDir = 0; float3 lightInReflDir = 0.0;
#ifdef _INDIRECT_DIFFUSE_OFF #ifdef _INDIRECT_DIFFUSE_OFF
#elif _INDIRECT_DIFFUSE_IBL #elif _INDIRECT_DIFFUSE_IBL
@@ -189,13 +202,17 @@ void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bs
UtsEvaluateBSDF_BakeDiffuse(posInput, preLightData, bsdfData, V, builtinData, lightInReflDir); UtsEvaluateBSDF_BakeDiffuse(posInput, preLightData, bsdfData, V, builtinData, lightInReflDir);
} }
#elif _INDIRECT_DIFFUSE_MATCAP #elif _INDIRECT_DIFFUSE_MATCAP
UtsEvaluateMatCap(posInput, bsdfData, 0.0, builtinData); //builtinData.bakeDiffuseLighting = UtsEvaluateColor_MatCap(posInput.positionWS, bsdfData.normalWS, 0.0);
UtsEvaluateBSDF_MatCapDiffuse(posInput.positionWS, bsdfData.normalWS, builtinData);
#elif _INDIRECT_DIFFUSE_RAMP #elif _INDIRECT_DIFFUSE_RAMP
UtsEvaluateRamp(posInput, bsdfData, builtinData); UtsEvaluateBSDF_Ramp(posInput, bsdfData, builtinData);
#endif #endif
if (featureFlags & LIGHTFEATUREFLAGS_ENV) if (featureFlags & LIGHTFEATUREFLAGS_ENV)
{ {
#if _INDIRECT_SPECULAR_OFF
#elif _INDIRECT_SPECULAR_IBL
context.sampleReflection = SINGLE_PASS_CONTEXT_SAMPLE_REFLECTION_PROBES; context.sampleReflection = SINGLE_PASS_CONTEXT_SAMPLE_REFLECTION_PROBES;
#if SCALARIZE_LIGHT_LOOP #if SCALARIZE_LIGHT_LOOP
@@ -257,9 +274,13 @@ void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bs
} }
} }
#elif _INDIRECT_SPECULAR_MATCAP
IndirectLighting lighting = UtsEvaluateBSDF_MatCapSpecular(posInput.positionWS, bsdfData, preLightData);
AccumulateIndirectLighting(lighting, aggregateLighting);
#endif
} }
#if _INDIRECT_SPECULAR_IBL
// Only apply the sky IBL if the sky texture is available // Only apply the sky IBL if the sky texture is available
if ((featureFlags & LIGHTFEATUREFLAGS_SKY) && _EnvLightSkyEnabled) if ((featureFlags & LIGHTFEATUREFLAGS_SKY) && _EnvLightSkyEnabled)
{ {
@@ -272,24 +293,11 @@ void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bs
// Only apply the sky if we haven't yet accumulated enough IBL lighting. // Only apply the sky if we haven't yet accumulated enough IBL lighting.
if (reflectionHierarchyWeight < 1.0) if (reflectionHierarchyWeight < 1.0)
{ {
IndirectLighting lighting = UtsEvaluateBSDF_Env(context, posInput, preLightData, envLightSky, bsdfData, envLightSky.influenceShapeType, IndirectLighting lighting = UtsEvaluateBSDF_Env(context, posInput, preLightData, envLightSky, bsdfData, envLightSky.influenceShapeType, GPUIMAGEBASEDLIGHTINGTYPE_REFLECTION, reflectionHierarchyWeight);
GPUIMAGEBASEDLIGHTINGTYPE_REFLECTION, reflectionHierarchyWeight);
AccumulateIndirectLighting(lighting, aggregateLighting); AccumulateIndirectLighting(lighting, aggregateLighting);
} }
} }
} #endif
if (featureFlags & LIGHTFEATUREFLAGS_DIRECTIONAL)
{
uint i = 0; // Declare once to avoid the D3D11 compiler warning.
for (i = 0; i < _DirectionalLightCount; ++i)
{
if (IsMatchingLightLayer(_DirectionalLightDatas[i].lightLayers, builtinData.renderingLayers))
{
DirectLighting direct = UtsEvaluateShading_Directional(context, posInput, builtinData, _DirectionalLightDatas[i], bsdfData, V);
AccumulateDirectLighting(direct, aggregateLighting);
}
}
} }
UtsPostEvaluateBSDF(posInput, preLightData, bsdfData, builtinData, aggregateLighting, lightLoopOutput); UtsPostEvaluateBSDF(posInput, preLightData, bsdfData, builtinData, aggregateLighting, lightLoopOutput);

View File

@@ -345,14 +345,21 @@ int _PassValue;
CBUFFER_END CBUFFER_END
int _ToonLightHiCutFilter;
int _ToonEvAdjustmentCurve;
float _ToonEvAdjustmentValueArray[128];
float _ToonEvAdjustmentValueMin;
float _ToonEvAdjustmentValueMax;
float _ToonEvAdjustmentCompensation;
float _ToonIgnoreExposureMultiplier;
float _Outline_MaxWidth; float _Outline_MaxWidth;
float4 _HairShadowRTHandleScale; float4 _HairShadowRTHandleScale;
float4 _HairBlendingRTHandleScale;
float _HairShadowDistance; float _HairShadowDistance;
float _HairShadowDistanceScaleFactor; float _HairShadowDistanceScaleFactor;
float _HairShadowDepthBias; float _HairShadowDepthBias;
float _HairShadowFadeInDistance; float _HairShadowFadeInDistance;
float _HairShadowFadeOutDistance; float _HairShadowFadeOutDistance;
float4 _HairBlendingRTHandleScale;

View File

@@ -199,9 +199,6 @@ void Frag(PackedVaryingsToPS packedInput,
UtsLightLoop(input, posInput, bsdfData, builtinData, V, featureFlags, lightLoopOutput); UtsLightLoop(input, posInput, bsdfData, builtinData, V, featureFlags, lightLoopOutput);
//#undef EVALUATE_BSDF_ENV
//#undef EVALUATE_BSDF_ENV_SKY
#ifdef _EMISSIVE_SIMPLE #ifdef _EMISSIVE_SIMPLE
float4 _Emissive_Tex_var = tex2D(_Emissive_Tex, TRANSFORM_TEX(UV0, _Emissive_Tex)); float4 _Emissive_Tex_var = tex2D(_Emissive_Tex, TRANSFORM_TEX(UV0, _Emissive_Tex));
float emissiveMask = _Emissive_Tex_var.a; float emissiveMask = _Emissive_Tex_var.a;