mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-13 22:39:39 -05:00
AdditionalLightが破綻していた問題を修正
This commit is contained in:
@@ -61,7 +61,7 @@ half4 MToonFragment(const FragmentInput fragmentInput) : SV_Target
|
||||
for (uint lightIndex = 0u; lightIndex < pixelLightCount; ++lightIndex)
|
||||
{
|
||||
UnityLighting additionalUnityLighting = GetAdditionalUnityLighting(input, normalWS, lightIndex);
|
||||
col.rgb += GetMToonLighting(additionalUnityLighting, mtoonInput).rgb;
|
||||
col.rgb += GetMToonURPAdditionalLighting(additionalUnityLighting, mtoonInput).rgb;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -211,4 +211,48 @@ half4 GetMToonLighting(const UnityLighting unityLight, const MToonInput input)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MTOON_URP
|
||||
|
||||
inline half GetMToonURPAdditionalLighting_Shadow(const UnityLighting lighting, const half dotNL)
|
||||
{
|
||||
if (MToon_IsPbrCorrectOn())
|
||||
{
|
||||
return lighting.directLightAttenuation.x * step(0, dotNL);
|
||||
}
|
||||
|
||||
return lighting.directLightAttenuation.x * 0.5 * (min(0, dotNL) + 1);
|
||||
}
|
||||
|
||||
inline half GetMToonURPAdditionalLighting_Shade(const UnityLighting lighting, const MToonInput input, const half dotNL)
|
||||
{
|
||||
const half shadeShift = GetMToonLighting_Reflectance_ShadingShift(input);
|
||||
const half shadeToony = _ShadingToonyFactor;
|
||||
|
||||
if (MToon_IsPbrCorrectOn())
|
||||
{
|
||||
const half shadeInput = dotNL;
|
||||
return mtoon_linearstep(-1.0 + shadeToony, +1.0 - shadeToony, shadeInput + shadeShift);
|
||||
}
|
||||
|
||||
const half shadeInput = dotNL;
|
||||
return mtoon_linearstep(-1.0 + shadeToony, +1.0 - shadeToony, shadeInput + shadeShift);
|
||||
}
|
||||
|
||||
half4 GetMToonURPAdditionalLighting(const UnityLighting unityLight, const MToonInput input)
|
||||
{
|
||||
const half dotNL = GetMToonLighting_DotNL(unityLight, input);
|
||||
const half shade = GetMToonURPAdditionalLighting_Shade(unityLight, input, dotNL);
|
||||
const half shadow = GetMToonURPAdditionalLighting_Shadow(unityLight, dotNL);
|
||||
|
||||
const half3 direct = GetMToonLighting_DirectLighting(unityLight, input, shade, shadow);
|
||||
const half3 lighting = direct;
|
||||
|
||||
const half3 baseCol = lighting;
|
||||
|
||||
return half4(baseCol, input.alpha);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user