Search Unity

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

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

  1. SeriouslyNot

    SeriouslyNot

    Joined:
    Nov 24, 2017
    Posts:
    121
    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. SeriouslyNot

    SeriouslyNot

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

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    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 SeriouslyNot like this.
  4. SeriouslyNot

    SeriouslyNot

    Joined:
    Nov 24, 2017
    Posts:
    121
    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,751
    You could try passing the time input through a mod() function, which allows you to specify the wrap around point.
     
    SeriouslyNot likes this.
  6. SeriouslyNot

    SeriouslyNot

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

    SeriouslyNot

    Joined:
    Nov 24, 2017
    Posts:
    121
    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,751
    That's correct. The result for mod(1003, 1000) is 3.
     
    SeriouslyNot likes this.
  9. SeriouslyNot

    SeriouslyNot

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

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    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.
     
  11. menofel

    menofel

    Joined:
    Sep 17, 2021
    Posts:
    6
    I have similar problem. When i move offset than my texture is looks like pixel art.

    upload_2023-12-18_23-45-44.png