Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Apr 17, 2012 at 03:39 AM by IgnoranceIsBliss for the following reason:

Bug In Unity

avatar image
0
Question by IgnoranceIsBliss · Apr 13, 2012 at 05:07 AM · androidshaders3.5

Android Shader Problem After Unity 3.5.1 Upgrade

I just upgraded from unity 3.4.x to 3.5.1 today and I have found a problem with shaders.

Before the update, I had a simple 'feathering' shader - the alpha increased towards the edge of a plane. Once my android project was compiling to Android 2.2 and OpenGL ES 2, the shader was working fine.

Since the update though, the shader has been falling through to the Fallback shader.

Previously the editor gave me a good idea what shaders would work on Android, but now the shader works fine in the editor but fails on the device.

There have been no code changes and there are no warnings that appear to refer to this shader in the log.

The shader is quite simple and relatively low-cost. There are three parameters - the texture, an alpha constant (for transparency) and a 'feathering' factor that controls the strength of the feathering effect.

Does anyone have any idea why it isn't working?

Thanks in advance for your help!

 Shader "Special/Feathered" {
     Properties {
         _MainTex ("Base (RGBA)", 2D) = "white" {}        
         _Feather ("Feather", Float) = 2
         _Alpha ("Alpha", Float) = 1
     }
     SubShader {
         Tags { "RenderType"="Transparent"
                "Queue"="Transparent" }
         LOD 200
         
         Blend SrcAlpha OneMinusSrcAlpha
         
         CGPROGRAM
         #pragma surface surf Lambert
 
         sampler2D _MainTex;        
 
         struct Input {
             float2 uv_MainTex;
         };
 
         half _Feather;
         half _Alpha;
 
         void surf (Input IN, inout SurfaceOutput o) {
             half4 c = tex2D (_MainTex, IN.uv_MainTex);
                                                 
             o.Albedo = c;
             o.Alpha = saturate((1-(distance(IN.uv_MainTex,(0.5,0.5)) * _Feather)));
             o.Alpha = min(o.Alpha,_Alpha);
         }
         ENDCG
     } 
     FallBack "Mobile/Diffuse"
 }
Comment
Add comment · Show 2
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 IgnoranceIsBliss · Apr 13, 2012 at 06:36 AM 0
Share

Interestingly with a statement as complex as the saturate one, it's the $$anonymous$$IN that seems to be the problem!

Without the '$$anonymous$$' the shader works properly!

avatar image IgnoranceIsBliss · Apr 13, 2012 at 06:42 AM 0
Share

CONFIR$$anonymous$$ED: This is the case. In the newest version of Unity (3.5.1f2) an Android shader that uses the '$$anonymous$$' function will fail and fall back.

If this is by design, could we get a warning? Otherwise can we get the bug fixed?

1 Reply

  • Sort: 
avatar image
0

Answer by IgnoranceIsBliss · Apr 17, 2012 at 03:38 AM

In the newest version of Unity (3.5.1f2) an Android shader that uses the 'min' function will fail and fall back.

This problem occurs on a Tegra 2-based tablet.

This must be due to a bug in Unity, as did not occur in previous versions.

Comment
Add comment · 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

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

3.5.6f4 issue. Android mobile unlit supports lightmap shader does not render properly on device. But it does for IOS. Is this shader broken for Android in this version? 0 Answers

Optimizing bump map or luminous textures on spheres for mobile 1 Answer

Can Standard Shader be removed from a build? 0 Answers

Android Crash on UpdateComputeBuffers in libunity.so 0 Answers

Game running faster on older device (Android) 2 Answers


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