- Home /
Android : safely using sprites w/ alpha channel?
Ok, I have a game for Android which is comprised of 2D sprites. I am currently using PNG's with transparency. Everything works, works perfectly on my Samsung Galaxy S, but I'm getting this warning for using the Transparent/Cutout/Diffuse shader:
Shader is using clip instruction (usually caused by alpha test). It might cause problems on some Qualcomm/Adreno drivers. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
But there's no cutout shader for mobile. So, can anyone tell me if there's a way to optimize textures with an alpha channel on mobile devices? And if not, how common will issues resulting from this be? Like I said, it works perfectly on my device. How common are these Qualcomm/Adreno drivers with the issues?
p.s. yes, I've researched this already online, and understand that as a rule using alpha channels on mobile is considered taxing on performance. Unfortunately, for the purposes of this game, it would be pretty unfeasible to try to get away from this method.
edit- oh yeah, forgot to mention, I'm also using a lot of these PNG's as GUI Textures, which seems to retain the alpha without a warning.. only objects in the scene with the image attached as a texture seem to throw out the warning. I am considering trying to put it all into GUI Textures, can anyone confirm if this would be preferable? Also, I'm curious to know exactly which devices contain the aforementioned drivers, so I could get hold of one to test with.. any help would be greatly appreciated!
EDIT: hmmm, yep, warning went away when I changed to Transparent/Diffuse. So I am assuming now that "Cutout" was the problem, which I guess I don't need, thought I did but I guess not.. Thanks!
Seems odd though, since cutout is all or none, while Transparent/Diffuse supports the full range.. I would think if anything it would be more taxing. Still wondering about this...
Hmmm, I've had no problems - but I use an Unlit/transparent shader.
ok, thanks.. I'll try that and see if it goes away :)
I use PowerPoint to make my textures since it has Transparency too
Answer by GianormousGames · Oct 18, 2012 at 08:03 PM
I traced crashed on HTC Thunderbolt into this. It's a really really really bad user experience - the phone locks up for 60 seconds and then reboots. If you're getting any of these warnings I'd recommend making sure your game runs on HTC Thunderbolt.
The cutout shaders have an alpha test that generates a clip instruction in the shader, which is why they generate the warning.
thanks, for now this is clearly the best answer :)
looks like that has a Snapdragon S2 processor
http://www.qualcomm.com/snapdragon/devices/htc-thunderbolt
to be safe, I will get an HTC Thunderbolt, haven't got it yet though.. look forward to crashing it as described!
Can you somehow ifdef that instruction in the shader based "Qualcomm/Adreno" or simply "Android"?
Answer by EthanWoo · Aug 20, 2013 at 04:38 PM
If you have a problem with shader due to building adk.
Try to build Android with Texture compression : Adreon ATC that is in the build setting you won't find any more " Shader is using clip instruction (usually caused by alpha test). It might cause problems on some Qualcomm/Adreno drivers."
sorry, where exactly would I find this setting? I have looked through all the build settings but I am not finding this option..
I don't really see what does compression have to do with shaders but I did try this and it did not work. Seth, go to File->Build Settings-Select Android platform. You will see a dropdown for 'Texture Compression', you can select ATC (Adreno) or other texture compressions here.
Your answer
Follow this Question
Related Questions
How to optimize multiple sprites,How to optimize multiple sprites? 2 Answers
Particles with the "Mobile/Particles/Alpha blended" look very dark on Nexus 4 0 Answers
Android touches wrong after using the application at least once 0 Answers
Android Game overheating Device 0 Answers
Google Play Realtime Multiplayer Only Works On One Account 0 Answers