Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Bug Shader Graph texture quality degradation iPadOS! (screenshot included)

Discussion in 'Shader Graph' started by FadiObaji, Sep 11, 2021.

  1. FadiObaji

    FadiObaji

    Joined:
    Nov 24, 2017
    Posts:
    109
    I have made simple shader-graphs to use in my game they work perfectly on PC, Android, Mac on even really old devices, but when it comes to iPad, things become weird.

    On iPad (Pro):
    All gameObjects that use shader-graphs gradually lose quality a bit by bit until eventually (after few minutes) appear very bad. Check the difference between the same shader:

    Both are the Same Prefab
    Left: when the game starts.
    Right: after few minutes of playing.



    And here's the shader graph:



    Note: It's not only this shader, all shader graphs lose quality after few minutes!
    Something worth noting though: i set all nodes' precision to half to make the shader less expensive.

    I tried All LTS versions of Unity, all seem to behave this way!

    Can anyone help me with this please?
     
  2. FadiObaji

    FadiObaji

    Joined:
    Nov 24, 2017
    Posts:
    109
  3. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,010
    Your use of Time is the problem. When using half precision instead of full precision as the resulting UV values becomes larger the precision (the minimum difference between two values which can be represented) reduces faster than with full precision.

    In general you should avoid using an ever increasing value as an input and instead use one which loops around at some point, because even with full precision you'll eventually hit the same problem with large enough values, specially in situations where the game can potentially run for very long time periods without being restarted, like on mobile, Nintendo Switch, and Xbox Series game suspend feature.
     
    Last edited: Sep 11, 2021
    Venkify and FadiObaji like this.
  4. FadiObaji

    FadiObaji

    Joined:
    Nov 24, 2017
    Posts:
    109
    I see.

    Is there a node that can do that? can you help me in achieving this please?
     
  5. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,010
    You could try passing the time input through a mod() function, which allows you to specify the wrap around point.
     
    FadiObaji likes this.
  6. FadiObaji

    FadiObaji

    Joined:
    Nov 24, 2017
    Posts:
    109
    You mean a modulo node? Could you give an example please?
     
  7. FadiObaji

    FadiObaji

    Joined:
    Nov 24, 2017
    Posts:
    109
    Oh, i think it goes like this mod(time, 1000) this would output from 0 to 999, and when time passes 1000 seconds the output would go back to 0 and repeat, right?
     
  8. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,010
    That's correct. The result for mod(1003, 1000) is 3.
     
    FadiObaji likes this.
  9. FadiObaji

    FadiObaji

    Joined:
    Nov 24, 2017
    Posts:
    109
    Thanks! You’re a genius.
     
  10. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    507
    Adding to that, if the values are only meant to deal with UV, you may well want to use 1 for modulo as the values are in the range 0 to 1 anyway.
     
unityunity