SoftMaskForUGUI icon indicating copy to clipboard operation
SoftMaskForUGUI copied to clipboard

Smaller element masked differently from another with mask

Open NibbleByte opened this issue 1 year ago β€’ 1 comments

Describe the bug I have a ScrollRect with mask to soften the edges. Inside I have "level icons" that are circles with mask to cut out the rectangular sprite into circle. In front of each circle, there is a paper element with score. That paper element is masked (faded) differently from the circle, allowing the circle to be visible from underneath. I'm not sure if I have bad setup or this is how it is supposed to work. image

Additional bug that may be related. When I increase the softness range of the scroll view mask, I get this visual artifact (clear circle inside the circle): image This may be related to the circle foreground image:

To Reproduce Steps to reproduce the behavior:

  1. Download this sample project: https://drive.google.com/file/d/126l7p4nG6ouXf4uJh9AkrZdmUP9og8fY/view?usp=sharing
  2. Run it and open the "PaperMap" scene
  3. Play the scene.
  4. Scroll up and down until some paper element with circle gets to the bottom edge of the scroll view.
  5. Increase the "Viewport" softness range.

Expected behavior

  • Circle and paper element should blend together - circle behind paper element should not be seen.
  • No "clear circle in circle" artifact.

Environment (please complete the following information):

  • Version 2.3.3 (as 2.3.4 and above cause compiler error on ShaderGraph for me).
  • Platform: Editor Windows
  • Unity version: 2023.2.9f1
  • Build options: URP

NibbleByte avatar Oct 20 '24 20:10 NibbleByte

Thank you for your reporting!

mob-sakai avatar Oct 20 '24 20:10 mob-sakai

I'm not sure if I have bad setup or this is how it is supposed to work.

It is a specification. However, as you mentioned, it does look unnatural. I’ll look into ways to improve the appearance. πŸ‘

For example, a method to compensate for soft mask magnification:

Oct-30-2024 10-16-00

PaperMap_-SoftMask_205-Windows__Mac__Linux-_Unity_2023_2_20f1__Metal__compressed

When I increase the softness range of the scroll view mask, I get this visual artifact (clear circle inside the circle):

In the latest version it has been fixed.

as 2.3.4 and above cause compiler error on ShaderGraph for me

Oops, it's my mistake. I'll create a new issue later.

mob-sakai avatar Oct 30 '24 01:10 mob-sakai

Yes, this looks better, it will be nice to have, although my design has changed and I no longer have this paper element in front. :D

I haven't created ticket for the compiler errors, because I'm not using LTS version, so I don't expect everything to work great. I'll soon upgrade to Unity 6 and get the latest version of the plugin.

NibbleByte avatar Oct 30 '24 20:10 NibbleByte

as 2.3.4 and above cause compiler error on ShaderGraph for me

This issue was fixed in version 2.3.9. πŸ‘

mob-sakai avatar Oct 31 '24 01:10 mob-sakai

Yes, this looks better, it will be nice to have, although my design has changed and I no longer have this paper element in front. :D

This enhancement has been released in version 2.4.0. πŸ‘

mob-sakai avatar Nov 01 '24 00:11 mob-sakai

I downloaded that version in the sample project and it seems increasing the power just makes it worse. I wish to go below 1? Or am I using it wrong? SoftMaskPowerUsageIssue

NibbleByte avatar Nov 01 '24 18:11 NibbleByte

Adjust the Foreground_Frame’s power.

mob-sakai avatar Nov 01 '24 19:11 mob-sakai

Ah yes, silly me. That works, thank you.

I have another small editor issue. Sometimes (for example when I just started the sample project), when tweaking the Power value while the game is running, everything in the soft mask stops drawing. Maximizing the game view (i.e. changing the resolution?) fixes it. SoftMaskNotDrawing

Similar thing happens on my original project, often when switching between fullscreen and window and clicking/drag the scrollview? - softmask stops drawing. To go fullscreen I use the Fullscreen Editor plugin, but I don't think it's related. (in the gif, I switch to fullscreen via hotkey, so the whole image changes suddenly multiple time). Showing the pause menu overlay also fixes the drawing (enabling game objects?)

SoftMaskNotDrawing2

(sorry for hijacking the issue, maybe create another issue? πŸ˜„ )

NibbleByte avatar Nov 01 '24 20:11 NibbleByte

Oh... I would like to know more about this issue. Could you please create a new issue? (Please attach a minimal reproducible project.)

Thank you πŸ‘

mob-sakai avatar Nov 01 '24 23:11 mob-sakai