Skip to content

Commit

Permalink
fix: MaskingShape.maskingMethod = Subtract is not working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Sep 4, 2024
1 parent 07c3afd commit 56e1262
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
12 changes: 0 additions & 12 deletions Packages/src/Runtime/MaskingShape/MaskingShape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,6 @@ Material IMaterialModifier.GetModifiedMaterial(Material baseMaterial)
var toUse = baseMaterial;
Material maskMat = null;
var colorMask = m_ShowMaskGraphic ? ColorWriteMask.All : 0;
if (SoftMaskingEnabled() && !UISoftMaskProjectSettings.useStencilOutsideScreen)
{
if (m_ShowMaskGraphic)
{
Profiler.BeginSample(
"(SM4UI)[MaskingShape)] GetModifiedMaterial > StencilMaterial.Add for SoftMask");
maskMat = StencilMaterial.Add(baseMaterial, _stencilBits, StencilOp.Keep, CompareFunction.Equal,
colorMask, _stencilBits, _stencilBits);
Profiler.EndSample();
}
}
else
{
Profiler.BeginSample("(SM4UI)[MaskingShape)] GetModifiedMaterial > StencilMaterial.Add");
switch (maskingMethod)
Expand Down
2 changes: 1 addition & 1 deletion Packages/src/Shaders/SoftMask.cginc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ float SoftMaskSample(float2 uv, float a)
#if SOFTMASK_EDITOR
int inScreen = step(0, uv.x) * step(uv.x, 1) * step(0, uv.y) * step(uv.y, 1);
alpha = lerp(_SoftMaskOutsideColor, alpha, inScreen);
clip (a * alpha.x * alpha.y * alpha.z * alpha.w - _AlphaClipThreshold * (1 - inScreen) - 0.001);
clip (a * alpha.x * alpha.y * alpha.z * alpha.w - _AlphaClipThreshold - 0.001);
#endif

return alpha.x * alpha.y * alpha.z * alpha.w;
Expand Down

0 comments on commit 56e1262

Please sign in to comment.