Page 1 of 1

Emission masking not working on Android device

PostPosted: Thu Dec 21, 2017 9:04 am
by TripleOneGames
I'm currently testing on the Samsung Galaxy S5. Unfortunately, it's all I have to test. When attempting to mask emission with a gradient, it doesn't work, but it does work on PC and iOS.

Example:

Image

The bottom image is how it appears on the Android device.

I'm basically using lerp from 1 to 0 from a point in world space to mask the emission. I'm using the same technique to create a color gradient in the albedo color, however, the albedo gradient works fine on the Android device.

Here is how my shader is set up:

Image

My guess is the gpu on that device, simply can't handle emission masking. I can say without a doubt that it's not an issue with the values, as the same values work for the albedo gradient. I'm hoping there is something I'm missing, or there is some kind of workaround I'm not thinking of. If not it's no biggie. Any help or tips is appreciated.

Re: Emission masking not working on Android device

PostPosted: Thu Dec 21, 2017 12:04 pm
by Amplify_Borba
Hello, thank you for taking the time to report this issue!

We're going to need a few more details in order to best help you out with this situation.

What is the target graphics API you're using, Open GL ES 2.0 or 3.0?

What Android version did you build for?

Also, would you be able to provide us with a shader sample as a Unity package with textures and any custom functions you might have so that we can debug it on our side?

Looking forward to your reply!

Re: Emission masking not working on Android device

PostPosted: Thu Dec 21, 2017 2:00 pm
by TripleOneGames
Sure thing!

I'm using:

GLES 3.0 and Vulcan (have both on the graphics API list)
Minimum Android version 6.0
Targeting Android version 7.1

Here is my shader:

VertexCollapse.rar
(3.78 KiB) Downloaded 443 times


I'm not using any textures or custom functions with this one. Thanks!

Re: Emission masking not working on Android device

PostPosted: Thu Dec 21, 2017 2:16 pm
by Amplify_Borba
Thank for sharing the shader together with the additional details.

One additional request, would you please remove Vulcan from the list and force GL 3.0, and report back with your findings?

We'll proceed to register your issue, however, the developer for this asset is going to take some time off for the holidays so we might only be able to get back to you next year, apologies for any inconvenience caused.

Thanks in advance!

Re: Emission masking not working on Android device

PostPosted: Thu Dec 21, 2017 4:17 pm
by TripleOneGames
No worries. There's no rush. I can always patch it in at a later if need be. I did try with only the GLES 3.0, and unfortunately, same result. Thanks for trying help anyways. I'll check back later. Even if it's not resolved in the end, I still feel this is a 5 star asset and have left a 5 star review on the asset store. Cheers, and happy holidays!

Re: Emission masking not working on Android device

PostPosted: Fri Dec 22, 2017 12:21 pm
by Amplify_Borba
TripleOneGames wrote:No worries. There's no rush. I can always patch it in at a later if need be. I did try with only the GLES 3.0, and unfortunately, same result. Thanks for trying help anyways. I'll check back later. Even if it's not resolved in the end, I still feel this is a 5 star asset and have left a 5 star review on the asset store. Cheers, and happy holidays!


Thank you for reporting back and for your understanding, we'll get back to you as soon as possible on this matter.

We hope you have a Merry Christmas and a Happy New Year!

Re: Emission masking not working on Android device

PostPosted: Wed Jan 03, 2018 6:20 pm
by Amplify_Borba
TripleOneGames wrote:No worries. There's no rush. I can always patch it in at a later if need be. I did try with only the GLES 3.0, and unfortunately, same result. Thanks for trying help anyways. I'll check back later. Even if it's not resolved in the end, I still feel this is a 5 star asset and have left a 5 star review on the asset store. Cheers, and happy holidays!


Hello, hope you've had a good time during the holidays and new year celebrations!

Regarding the issue you've reported, after extensive tests we found a way to solve your problem but not exactly the root of the issue.

Everything indicates to be an issue from Unity that we can neither track nor know for sure why it's happening. It only happens when you have a "lerp" operation that uses a property value in some fashion. If that dependency happens the value from the lerp gets outside of the range provided from the input values, and starts to get negative or inverted. Since The "HSVtoRGB" node uses a lerp at the end and it's input parameter for the "value" is a property it's destroying your effect.

We also found that this does not happen in GLES 2.0 which further indicates that the issue stems from Unity. Even the compiled assembly code from the shader looks fine and even if you use a global property like _SinTime the problems still occurs.

Since you need both GLES3.0 and VULKAN we tried to come up with a solution and the best so far was to either convert the property value into a constant or to add a saturate operation after the "HSVtoRGB" node (which contains the lerp).

NodeSetup.png
NodeSetup.png (141.17 KiB) Viewed 4359 times


We'll dig a bit further and most likely open up a bug report in Unity issue tracker, thank you once more for reporting this and don't hesitate to get back in touch if you come across any other issues!

Re: Emission masking not working on Android device

PostPosted: Mon Apr 09, 2018 10:55 pm
by TripleOneGames
Sorry for the delay guys. I got busy with another project. I was able to test this workaround and test on Android and it does work! Thanks again for your time and help with this issue.

Re: Emission masking not working on Android device

PostPosted: Tue Apr 10, 2018 9:59 am
by Amplify_Borba
No problem, thank you so much for confirming that the workaround did work out for you!

Please let us know if you come across any further issues, thanks!