Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by toothycat · Jun 17, 2011 at 09:43 AM · androidalphaalphablend

Destination alpha blending on Android device

I have a set of shaders that accumulates values in the framebuffer alpha channel over multiple passes (using ColorMask A / Blend SrcAlpha One), then uses Blend DstAlpha OneMinusDstAlpha to render semitransparent geometry.

This works just fine on the desktop, but the final render becomes fully opaque when I run on an actual Android phone.

If I turn off the final pass, comment out the ColorMasks and write alpha to the colour channels, I get the same, correct, greyscale output on desktop and mobile, so the intermediate pass shaders are compiling and working correctly.

Are there known issues with destination alpha blending on Android? Does the default framebuffer on Android have an alpha channel, and if not, how do I change that? Not having either destination alpha or the stencil buffer exposed to us would make a lot of effects very difficult to implement sensibly, can this really be the case? What am I missing?

Thanks

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jessy · Jun 17, 2011 at 01:12 PM 0
Share

I've got no idea how to fix it on Android, but I bet it's settable via the Editor in 3.4 like with iOS. http://answers.unity3d.com/questions/44333/what-shader-blending-modes-dont-work-on-ios.html

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by toothycat · Jun 17, 2011 at 01:59 PM

After Jessy's comment and reading the section on plugins, I can confirm that the default framebuffer on mobile Android devices does not in fact contain an alpha channel. This can be fixed (in a version of Unity that allows plugins) as follows:

  • create a Plugins/Android directory in Assets

  • take a copy of UnityPlayerActivity.java (by default in C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer\src\com\unity3d\player) and AndroidManifest.xml (by default in C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer)

  • Rename UnityPlayerActivity to something else (both the filename and the class name inside the file). Find the line boolean trueColor8888 = false;, change to true. Change the class name inside the manifest to the new class name.

  • Compile with javac, making sure to include the Unity playback classes (in c:/Program Files (x86)/Unity/Editor/Data/PlaybackEngines/androidplayer/bin/classes.jar by default) in the classpath, and also the Android SDK class library (e.g. -bootclasspath \android\android-sdk\platforms\android-11\android.jar)

  • Pack the resulting binaries into a file called classes.jar in the Plugins/Android directory

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image madflyskills · Mar 11, 2013 at 04:10 PM 1
Share

for the curious ones, UnityPlayerActivity.java is located here on $$anonymous$$AC: /Applications/Unity/Unity.app/Contents/PlaybackEngines/AndroidPlayer/src/com/unity3d/player

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Android video with alpha playback without transcode 0 Answers

How can i set transparent pixels on a RenderTexture? 1 Answer

Is it reasonable to use transparency on Android? 1 Answer

Particles with the "Mobile/Particles/Alpha blended" look very dark on Nexus 4 0 Answers

Shader Doesn't Work On Android 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges