mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-07 11:28:35 -05:00
Add Pbr Correct mode.
This commit is contained in:
@@ -18,6 +18,12 @@
|
||||
#define MTOON_IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL > 0.0) ? (FRONT) : (BACK))
|
||||
#endif
|
||||
|
||||
// Compile-time constant
|
||||
inline bool MToon_IsPbrCorrectOn()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Compile-time constant
|
||||
inline bool MToon_IsForwardBasePass()
|
||||
{
|
||||
|
||||
@@ -38,6 +38,12 @@ inline half GetMToonLighting_Shade(const UnityLighting lighting, const MToonInpu
|
||||
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);
|
||||
}
|
||||
|
||||
if (MToon_IsForwardBasePass())
|
||||
{
|
||||
const half shadeInput = lerp(-1, 1, mtoon_linearstep(-1, 1, dotNL) * lighting.directLightAttenuation);
|
||||
@@ -52,6 +58,11 @@ inline half GetMToonLighting_Shade(const UnityLighting lighting, const MToonInpu
|
||||
|
||||
inline half GetMToonLighting_Shadow(const UnityLighting lighting, const half dotNL)
|
||||
{
|
||||
if (MToon_IsPbrCorrectOn())
|
||||
{
|
||||
return lighting.directLightAttenuation * (min(0, dotNL) + 1);
|
||||
}
|
||||
|
||||
if (MToon_IsForwardBasePass())
|
||||
{
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user