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
2.09k stars 269 forks source link

Word canvas does not work correctly in build #194

Closed oktayturkdagli closed 1 month ago

oktayturkdagli commented 2 months ago

Describe the bug There is no problem in Editor mode and Runtime, but in the android(API 33)(IL2CPP or Mono doesn't matter) build the mask is not displayed correctly in the world canvas.

To Reproduce I have no idea how to reproduce this bug.

Environment:

oktayturkdagli commented 2 months ago

Unfortunately I cannot provide additional information as the project is too big :/

oktayturkdagli commented 2 months ago

This is a project with project settings by the company, in the build the mask and the masked image are not visible at all, if I check the box show mask image then only the mask is visible but not the masked image. In a smaller project that I'm just trying out, everything works great. Which settings should I pay attention to.

mob-sakai commented 2 months ago

Thank you for your reporting!

If you need a quick fix, please try using AntiAliasing instead of MaskingMode=SoftMasking.

mob-sakai commented 2 months ago

I would like to know more about this issue.

oktayturkdagli commented 2 months ago

No, the mask works correctly in these modes.

Yes.

I don't know, I'll look into it. But I guess we don't use it. In addition, I downloaded all the additional packages and tried different experiments.

I've tried all ETC2 formats, including ETC2 8Bit. The result is the same. It also works correctly even if I don't use ETC2 in another project.

I can't try the workaround because it's Saturday here. Hopefully, we'll get it sorted over the weekend. I built about 30 builds yesterday. I appreciate your efforts.

By the way, there is no problem with version 1.0.2, but there is a problem with version 2.0.0 and above. But we don't use version 1.0.2 because the images are not displayed correctly in the moving scrollview and there are many more bugs. 2.3.3 is great but only has this problem.

mob-sakai commented 2 months ago

Thank you. Continue to ask questions:

oktayturkdagli commented 2 months ago

No, I didn't, I even used simpler primitive images to try it out, but the result was the same.

Yes, the shaders seem to be correct (4 by default)

I can't take screenshots because I don't have access to the project right now. But I'm doing a mask photo (it's definitely a 9slice photo), plus the photo to be masked as the child of this mask(normal ETC2 8bit photo or ETC1 normal photo). Then add a soft mask to the mask and get built. I also copied and pasted the whole ProjectSettings folder from another project where the soft mask was already working and the result is the same. I deleted and reinstalled the libraries and the same. I deleted the soft mask, closed the project, reopened it, and reinstalled the soft mask and the result is the same.

Also, I usually do my experiments on the sample project and when I check the world canvas, the soft mask is broken. So you can try it on the sample project.

mob-sakai commented 1 month ago

Thank you for your response. 👍

Also, I usually do my experiments on the sample project and when I check the world canvas, the soft mask is broken. So you can try it on the sample project.

Umm... that is not reproduced on my environment...

  1. I'd like you to try something. Please test the following versions:

    • 2.3.4 (latest version)
    • 2.2.4 (previous minor version)
  2. Could you attach the ProjectSettings directory and the URP assets from your project? Alternatively, does the issue still occur in a new project using those settings? If the problem lies in any of the ProjectSettings or URP assets, it should reproduce as well.

  3. The demo scene includes a sample that displays the softmask buffer. How does it appear on your Android device?
    This will help identify which part of the process (softmask buffer generation, shaders, etc.) is causing the issue.

oktayturkdagli commented 1 month ago

Your First Answer: Thank you for your reporting! If you need a quick fix, please try using AntiAliasing instead of MaskingMode=SoftMasking.

Yes, this works as a temporary solution. This method works even if the image is not in ETC2 format.

  1. I'd like you to try something. Please test the following versions.

I tried with both versions and the result is the same (also 2.3.5). By the way, after update 2.3.5 the masks now appear pink, when I switch to anti alising mode they appear correctly.

Ekran Resmi 2024-09-16 09 33 40 Ekran Resmi 2024-09-16 09 33 56
  1. Could you attach the ProjectSettings directory and the URP assets from your project?

I haven't tried this, I'll try it right away and write. ProjectSettings.zip Settings.zip We are using High URP asset.

  1. The demo scene includes a sample that displays the softmask buffer.

I'll try this right away and write.

mob-sakai commented 1 month ago

By the way, after update 2.3.5 the masks now appear pink, when I switch to anti alising mode they appear correctly.

Wow, what a big mistake. I'll fix it right away.

mob-sakai commented 1 month ago

please try version 2.3.6.

oktayturkdagli commented 1 month ago

That's fast, you're great, and I'm going to try some of the experiments you suggested. I added URP Settings to below comment.

oktayturkdagli commented 1 month ago

By the way, there is a shader graphic in the project. Made with amplify.

oktayturkdagli commented 1 month ago

Ok, build the sample project android build and see what happens when you switch to world canvas. I'll add a image in a bit. I copied the project settings and urp settings asset as you said. I created a completely clean project and examined the results.

SoftMaskAndroidBuildWorldCanvasTest.zip

Screenshot_20240916_102157_Farmer Simulator Ultimate

mob-sakai commented 1 month ago

Great! Thank you so much for your amazing help!

mob-sakai commented 1 month ago

That issue was reproduced on my Android as well! 👍 Additionally, the issue was also reproduced in Screen Space - Camera.

mob-sakai commented 1 month ago

I have found the cause of the problem. If the Render Scale in the Universal Render Pipeline Asset is not set to 1.0, the problem occurs. (Let's try!)

oktayturkdagli commented 1 month ago

You're the best.

mob-sakai commented 1 month ago

Similarly, the same issue occurred when using Dynamic Resolution. I will add a new option "Use Dynamic Resolution (default: false)" to the ProjectSettings to support both Dynamic Resolution and Render Scale.

oktayturkdagli commented 1 month ago

That's great! I can't wait to try it. 👏👏👏

oktayturkdagli commented 1 month ago

Any news?

mob-sakai commented 1 month ago

Hi. Sorry for the late reply. I was struggling with an edge case regarding dynamic resolution. (To be clear, there are many undocumented specifications...) I have decided to omit it, at least until I have researched a safe way to implement it.

The RC version only supports UniversalRenderPipelineAsset.renderScale. This is not an option, it is automatically enabled. Please try it.

"com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git?path=Packages/src#develop",
oktayturkdagli commented 1 month ago

Hi, I haven't had a chance to try it because there has been a big rush in recent days. I plan to try it tomorrow.

oktayturkdagli commented 1 month ago

Unfortunately, I couldn't try today and tomorrow is the weekend here. I hope a stable solution will be found by Monday, but if not I will try this RC and report back.

mob-sakai commented 1 month ago

@oktayturkdagli Oh, sorry, I forgot to push. The RC version is now available in the develop branch.

oktayturkdagli commented 1 month ago

I confirm that the world canvas and Camera canvas problems are solved, but this version breaks the overlay canvas. This also breaks many other features such as alpha hit test, nested soft masking, transform sensitivity.

SoftmaskTestProject.zip

softmask

mob-sakai commented 1 month ago

@oktayturkdagli Thank you for your feedback!

mob-sakai commented 1 month ago

@oktayturkdagli I’ve updated the develop branch. Please give it a try! 👍

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 2.3.8 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: