mob-sakai / SoftMaskForUGUI

Enhance Unity UI (uGUI) with advanced soft-masking features to create more visually appealing effects!
https://github.com/mob-sakai/SoftMaskForUGUI
MIT License
1.91k stars 257 forks source link

[v1] Masked elements are off-set if canvas is not full screen #165

Closed alberto-salieto-scopely closed 14 hours ago

alberto-salieto-scopely commented 2 months ago

Hello,

Description Masked elements are off-set if canvas is not full screen.

It is caused by line 39 in SoftMask.cginc

half2 view = clipPos.xy/_ScreenParams.xy;

specifically _ScreenParams.xy. According to https://docs.unity3d.com/Manual/SL-UnityShaderVariables.html, it returns camera render size in pixels, not canvas size. Proposed fix is to pass offsets to calculate true canvas size and position.

Expected behavior The mask should be in the proper position according to the canvas position. In our case, canvas is displaced because of the notch, so it doesn't have the fullscreen size.

Environment

mob-sakai commented 1 month ago

Thank you for your reporting! Could you please attach a minimal project (included Assets, Packages and ProjectSettings directories) that reproduces the issue?

repos

mob-sakai commented 14 hours ago

Please try v2: https://github.com/mob-sakai/SoftMaskForUGUI/releases/tag/v2.0.0