Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Word canvas does not work correctly in build #194

Closed
oktayturkdagli opened this issue Sep 13, 2024 · 29 comments
Closed

Word canvas does not work correctly in build #194

oktayturkdagli opened this issue Sep 13, 2024 · 29 comments
Assignees
Labels
bug Something isn't working released

Comments

@oktayturkdagli
Copy link

oktayturkdagli commented Sep 13, 2024

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:

  • Version: 2.3.3
  • Platform: Mac
  • Unity version: Unity 2022.3.45
  • Build options: [ IL2CPP, .Net 4.x, URP, Android(API 33)]
@oktayturkdagli oktayturkdagli added the bug Something isn't working label Sep 13, 2024
@oktayturkdagli oktayturkdagli changed the title Word canvas does not work correctly in build Word canvas ScrollView does not work correctly in build Sep 13, 2024
@oktayturkdagli oktayturkdagli changed the title Word canvas ScrollView does not work correctly in build Word canvas does not work correctly in build Sep 13, 2024
@oktayturkdagli
Copy link
Author

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

@oktayturkdagli
Copy link
Author

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
Copy link
Owner

mob-sakai commented Sep 14, 2024

Thank you for your reporting!

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

@mob-sakai
Copy link
Owner

I would like to know more about this issue.

@mob-sakai mob-sakai added the need more info Need more information to help label Sep 14, 2024
@oktayturkdagli
Copy link
Author

oktayturkdagli commented Sep 14, 2024

  • Does this issue also occur in Screen Space - Overlay or Screen Space - Camera modes?

No, the mask works correctly in these modes.

  • Are you using URP (Universal Render Pipeline)?

Yes.

  • Are you using ShaderGraph?

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.

  • Are you using the RGB ETC1 (+ Split alpha channel) texture format?

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
Copy link
Owner

Thank you. Continue to ask questions:

  • Do you use materials other than UI/Default for masked Graphics?
  • See Project Settings > UI > Soft Mask > Included Shaders. Are the shaders set correctly?
  • If possible, please attach a screenshot (replace the texture if necessary) or the inspector.

@oktayturkdagli
Copy link
Author

oktayturkdagli commented Sep 14, 2024

  • Do you use materials other than UI/Default for masked Graphics?

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

  • See Project Settings > UI > Soft Mask > Included Shaders. Do you know if the shaders set correctly?

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

  • If possible, please attach a screenshot (replace the texture if necessary) or the inspector.

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 mob-sakai removed the need more info Need more information to help label Sep 15, 2024
@mob-sakai
Copy link
Owner

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...

  • Version: 2.3.3
  • Platform: Mac
  • Unity version: Unity 2022.3.45
  • Graphic API: Vulkan/OpenGLES3
  • Texture format: ETC2
  • Sprite mode: Sprite Atlas V2
  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
Copy link
Author

oktayturkdagli commented Sep 16, 2024

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
Copy link
Owner

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
Copy link
Owner

please try version 2.3.6.

@oktayturkdagli
Copy link
Author

oktayturkdagli commented Sep 16, 2024

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
Copy link
Author

oktayturkdagli commented Sep 16, 2024

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

@oktayturkdagli
Copy link
Author

oktayturkdagli commented Sep 16, 2024

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
Copy link
Owner

Great!
Thank you so much for your amazing help!

@mob-sakai
Copy link
Owner

mob-sakai commented Sep 16, 2024

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

@mob-sakai
Copy link
Owner

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
Copy link
Author

You're the best.

@mob-sakai
Copy link
Owner

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
Copy link
Author

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

@oktayturkdagli
Copy link
Author

Any news?

@mob-sakai
Copy link
Owner

mob-sakai commented Sep 18, 2024

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
Copy link
Author

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
Copy link
Author

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 added a commit that referenced this issue Sep 21, 2024
@mob-sakai
Copy link
Owner

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

@oktayturkdagli
Copy link
Author

oktayturkdagli commented Sep 23, 2024

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
Copy link
Owner

@oktayturkdagli
Thank you for your feedback!

@mob-sakai
Copy link
Owner

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

github-actions bot pushed a commit that referenced this issue Sep 29, 2024
## [2.3.8](v2.3.7...v2.3.8) (2024-09-29)

### Bug Fixes

* if `UniversalRenderPipelineAsset.renderScale` is not 1, soft masking will not be rendered correctly ([6e5a7f9](6e5a7f9)), closes [#194](#194)
* in URP, dynamic resolution does not work when render scale is close to 1 ([afed40a](afed40a))
* recreates ProjectSettings scriptable object when the project is pulled from GitHub ([9f6ea22](9f6ea22)), closes [#200](#200)
* when using dynamic resolution, soft masking will not be rendered correctly ([5100e3f](5100e3f)), closes [#199](#199)
Copy link

🎉 This issue has been resolved in version 2.3.8 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this issue Sep 29, 2024
github-actions bot pushed a commit that referenced this issue Sep 29, 2024
## [2.3.8](v2.3.7...v2.3.8) (2024-09-29)

### Bug Fixes

* if `UniversalRenderPipelineAsset.renderScale` is not 1, soft masking will not be rendered correctly ([6e5a7f9](6e5a7f9)), closes [#194](#194)
* in URP, dynamic resolution does not work when render scale is close to 1 ([afed40a](afed40a))
* recreates ProjectSettings scriptable object when the project is pulled from GitHub ([9f6ea22](9f6ea22)), closes [#200](#200)
* when using dynamic resolution, soft masking will not be rendered correctly ([5100e3f](5100e3f)), closes [#199](#199)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

2 participants