|
@@ -95,6 +95,9 @@ struct clearcoatOutParams
|
|
const in float ambientMonochrome,
|
|
const in float ambientMonochrome,
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
+ #if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)
|
|
|
|
+ const in float frontFacingMultiplier,
|
|
|
|
+ #endif
|
|
out clearcoatOutParams outParams
|
|
out clearcoatOutParams outParams
|
|
)
|
|
)
|
|
{
|
|
{
|
|
@@ -165,7 +168,9 @@ struct clearcoatOutParams
|
|
#if defined(TANGENT) && defined(NORMAL)
|
|
#if defined(TANGENT) && defined(NORMAL)
|
|
mat3 TBNClearCoat = vTBN;
|
|
mat3 TBNClearCoat = vTBN;
|
|
#else
|
|
#else
|
|
- mat3 TBNClearCoat = cotangent_frame(clearCoatNormalW * clearCoatNormalScale, vPositionW, vClearCoatBumpUV, vClearCoatTangentSpaceParams);
|
|
|
|
|
|
+ // flip the uv for the backface
|
|
|
|
+ vec2 TBNClearCoatUV = vClearCoatBumpUV * frontFacingMultiplier;
|
|
|
|
+ mat3 TBNClearCoat = cotangent_frame(clearCoatNormalW * clearCoatNormalScale, vPositionW, TBNClearCoatUV, vClearCoatTangentSpaceParams);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#if DEBUGMODE > 0
|
|
#if DEBUGMODE > 0
|
|
@@ -185,7 +190,7 @@ struct clearcoatOutParams
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
|
|
#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
|
|
- clearCoatNormalW = gl_FrontFacing ? clearCoatNormalW : -clearCoatNormalW;
|
|
|
|
|
|
+ clearCoatNormalW = clearCoatNormalW * frontFacingMultiplier;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
outParams.clearCoatNormalW = clearCoatNormalW;
|
|
outParams.clearCoatNormalW = clearCoatNormalW;
|