Search Unity

Unity 5.6 and shadow issues on Android

Discussion in 'Android' started by wildbean, Jun 7, 2017.

  1. wildbean

    wildbean

    Joined:
    Nov 17, 2012
    Posts:
    20
    Hi all , my game has been running great even on old Android devices like Samsung Galaxy S3 , but I've found since upgrading Unity to 5.6 that the realtime shadows have degraded *dramatically*. The shadows now glitch and jump around - becoming very blocky, and actually get worse and worse the longer you spend playing the game. The framerate has tanked as a result it seems as well.

    I've confirmed this on several S3 and S3-Mini devices.

    However the game still runs perfectly fine on my Nexus 5, and all newer phones such as S6 / Nexus 5x / S8 that we have tested as well.

    Any ideas on what could be causing this, and possible solutions?
     
  2. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    Can you please create a bug report with repro case and post the case number here?
    Please mention the exact model number for Samsung devices and the Android version that you are running.

    What shader are you using?
    Does it maybe only happen with OpenGL ES 2.0?
     
  3. wildbean

    wildbean

    Joined:
    Nov 17, 2012
    Posts:
    20
    Sure, thanks for the response. I'll do some more testing and come back with some more details for you.
     
  4. wildbean

    wildbean

    Joined:
    Nov 17, 2012
    Posts:
    20
    I've done some more testing and submitted a bug report with repro case 919669.

    I was previously using a custom vertex color shader on my project , however even after creating a new simple test project for this bug report and using only basic cubes and Unity's built-in Mobile Diffuse shader I'm seeing this issue as demonstrated in the attached project.

    Hopefully you can shed some light on this for me! Thanks

    *edit* Oh one other thing - I forgot to mention in the bugreport that the Android Version on the S3 (GT-I9300) is Android 4.3.
     
  5. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    QA closed the case as a duplicate of case https://issuetracker.unity3d.com/is...ing-away-from-world-origin-on-older-mali-gpus. But thanks for reporting, I think your repro project might still be useful.

    We didn't really look into the problem yet, but it all sounds like shader precision issues. afaik Mali 400 varyings and fragment shaders are lower precision than most others (basically only what the OpenGL ES 2 or GLSL ES 1.0 spec mandates for mediump).
     
  6. wildbean

    wildbean

    Joined:
    Nov 17, 2012
    Posts:
    20
    Ok sure, hope my report helps.

    Any pointers on how I could workaround this, as obviously using standard shaders on my mobile game is not going to work for me, and I imagine it's not yet known when that bug will be fixed? I was aiming to launch very soon before I hit this issue.

    *edit*
    Also, does the fact that it worked fine for my project on 5.5.2f1 give us anything else to go on do you think?

    I notice the existing bug 908253 has a severity of 3, and when I mouseover that number it says a workaround is possible. Can you point me to where I could find a known workaround by any chance? Thanks
     
    Last edited: Jun 14, 2017
  7. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    We figured out that the regression was introduced in Unity 5.6. The calculation of the shadow coordinate was moved to the fragment shader (for shadow masking).
    But using world coordinates on a GPU that can only do mediump in the fragment shader doesn't really work.
    We are working on a fix.

    I can't think of a simple workaround other than modifying the shaders accordingly.
     
  8. wildbean

    wildbean

    Joined:
    Nov 17, 2012
    Posts:
    20
    Hi again, I see that bug now has a status of "Fixed in future release" - out of interest is it known (or visible anywhere) what specific version it will be fixed in, so as I can decide on my best course of action? Thanks
     
  9. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    Since this is a regression that appeared in 5.6 we will try to backport the fix to 5.6.
     
  10. wildbean

    wildbean

    Joined:
    Nov 17, 2012
    Posts:
    20
    Ok great thanks. Does this essentially mean that version 5.6.3f1 would have it? Or any rough ETA on when it might happen?
     
  11. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    I hope it will be fixed in a patch release until 5.6.3f1, but not guaranteed. It is not a trivial fix and requires changes to Surface Shader code generation and shader includes.
     
  12. wildbean

    wildbean

    Joined:
    Nov 17, 2012
    Posts:
    20
    Well I've just tested and my bug is still present in Unity 2017.2 version.