Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[BUG found] Shader Graph on android textures pixelization

Discussion in 'Shaders' started by NakoRinn, Mar 13, 2019.

  1. NakoRinn

    NakoRinn

    Joined:
    Jul 17, 2018
    Posts:
    15
    Hello , I create shader by using shadergraph and LWRP settings.
    On my editor albedo texture looks good , but on android I got some issues.

    Albedo texture pixelization

    Using maximum quality settings , disabling mipmaps and compression on textures - don`t resolve this issue.

    Then i test this texture with same tiling on standart material and its work fine.
    Are anyone can help with this bug, any ideas to resolving ?
     
    Last edited: Mar 14, 2019
  2. NakoRinn

    NakoRinn

    Joined:
    Jul 17, 2018
    Posts:
    15
    Using this graph


    Builds on Android and Windows


    Settings


    I work with this shader more then month and really need help
     
  3. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,845
    What are the settings on the texture itself (water5)?
     
  4. NakoRinn

    NakoRinn

    Joined:
    Jul 17, 2018
    Posts:
    15


    Also i include HDRP from package manager to my project.
    Are any settings can conflicts between ?
     
  5. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,845
    You have compression turned on (DXT1) on the texture.
    Can you try an uncompressed format?
     
  6. NakoRinn

    NakoRinn

    Joined:
    Jul 17, 2018
    Posts:
    15
    I try build with different compression and with disabled , result is the same.
     
  7. NakoRinn

    NakoRinn

    Joined:
    Jul 17, 2018
    Posts:
    15
    1) Create a new project , switch platform to android
    2) Import CORE RP , LWRP , shadergraph packages
    3) Create a new shader using shadergraph (Sample texture with 15,15 tiling )
    4) Put 2 planes nearby
    - first with recently created shader
    - second with standart shader

    You can see configurations on this picture


    5)Build and test on my devices (Pocophone f1 , Sony f8331)
    At result :


    Unity 18.3.8f1

    Maybe I miss something important ?
     
  8. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,845
    This really looks like a shader graph bug. Can you please make a bug report?
     
  9. NakoRinn

    NakoRinn

    Joined:
    Jul 17, 2018
    Posts:
    15
    Will reported
     
  10. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,845
    Thanks a lot!
     
  11. NakoRinn

    NakoRinn

    Joined:
    Jul 17, 2018
    Posts:
    15
    Just upload video
     
  12. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,845
    I meant making a bug report using Unity bug reporter :)
     
  13. NakoRinn

    NakoRinn

    Joined:
    Jul 17, 2018
    Posts:
    15
    I sent ticket to "bag reporter" also.
    Will waiting for some answers ;)
     
  14. WilliamBenichou

    WilliamBenichou

    Joined:
    Apr 11, 2016
    Posts:
    9
    Any feedback for this issue? Did you manage to solve it? Just encountering one very simillar, but without texture this time, only Voronoï and Simple noise made water shader. On desktop, it is perfect, but on Android, very pixelated.
     
    Last edited: May 15, 2019
  15. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,133
    These sort of pixellation artifacts on mobile devices are caused by limited precision on the hardware, causing floating point errors (numbers running up too high or low). This unfortunately varies per device. It is even more prominent when using time to offset your UV's, making the pixellation will grow worse as time progresses.

    In most cases this can be resolved by using float precision on the variable involved (as opposed to half or fixed). Or doing the UV calculations in the vertex shader, which inherently has far higher precision than the fragment shader stage. Unfortunately these things cannot be controlled in Shader Graph, but hopefully in the future.

    A possible solution would be to adjust the UVs of your mesh so they stay within the 0-1 range, here is a good example. It also mentions splitting up your water into individual tiles can be viable. All in all it should be possible to work this out, but will require some trial and error to get it right for your particular setup ;)
     
  16. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    Yeah, the bug is Shader Graph always uses 16 bit half precision for UVs. On desktop this is ignored, but on some mobile platforms this means you run out of enough precision to sample a 1024x1024 texture smoothly after just a few repeats of the texture. Until Unity lets users select between float and half for interpolated UVs this will always be a problem with Shader Graph.

    Unfortunately some mobile GPUs use 16 bit UVs in the texture sampling hardware itself, so you'll still have the problem on those devices. Using a vertex fragment shader you could adjust the UVs to be camera relative to combat this, but as you can't control what is done in the vertex vs fragment shader with Shader Graph this isn't something you can do here.
     
    R0man, hippocoder and WilliamBenichou like this.
  17. WilliamBenichou

    WilliamBenichou

    Joined:
    Apr 11, 2016
    Posts:
    9
    Thanks guys, you're saving us! Will try splitting the sea and also keeping uv offset between 0 and 1
     
  18. wechat_os_Qy04JjeaZXMZ9QEv0YtbTXrG8

    wechat_os_Qy04JjeaZXMZ9QEv0YtbTXrG8

    Joined:
    Jun 11, 2019
    Posts:
    1
    • May I ask how this problem was finally solved
     
  19. NakoRinn

    NakoRinn

    Joined:
    Jul 17, 2018
    Posts:
    15
    Finally I continue work with "Amplify shader editor".
     
  20. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    218
    We're ran in the same problem with Oculus Quest. Really annoying. Can you send us your issue number for keep track of it?
     
  21. Airship

    Airship

    Joined:
    Sep 10, 2011
    Posts:
    260
    + 1 for this issue. Hopefully Shader Graph fixes
     
  22. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    Is there any solution?
     
  23. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Bug seems to persist.
     
  24. yufeng_issac

    yufeng_issac

    Joined:
    Jun 11, 2019
    Posts:
    2
    it is caused by the use of "half" for uv in the code generated by shader graph.
    when the tilling or offset is too big. it is easily reached the limitation of half precision.
    and there is an alternative: in the shader graph, right click the PBR Master and choose "Copy shader".
    then paste the code anywhere you want and save it as a shader file.(eg: test.shader)
    in the shader file search for all the "struct GraphVertexOutput" and "struct SurfaceDescriptionInputs", change the uv under the struct from half to float.
    finally replace your shader with this new shader, it is the exactly the same as the shader graph shader.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      23.9 KB
      Views:
      769
    R0man, ROBYER1 and hippocoder like this.
  25. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Thanks a lot - very helpful. I wonder why Unity isn't fixing this though? it's pretty stupid for it to persist, affecting a huge amount of users, including clients.
     
    R0man likes this.
  26. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,444
    Is this reported to the QA team through the Bug Reporter and do you have a bug report case reference for it if so?
     
    NeatWolf likes this.
  27. drt_gamearound

    drt_gamearound

    Joined:
    Apr 1, 2013
    Posts:
    263
    How do I "replace your shader with this new shader"??
     
  28. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Create a new empty unlit shader and paste the copied shader there, overwriting it. Tweak the name etc.
     
  29. drt_gamearound

    drt_gamearound

    Joined:
    Apr 1, 2013
    Posts:
    263
    Do you mean an Unlit Shader or an Unlit Graph? If it is an Unlit Shader I reach this part and I already have this shader, but the point is how do I add this to the Shader Graph Editor, or how do I add to the shader I have already created with Shader Graph Editor?
     
  30. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Unit shader because when you right click the output node and copy, it copies text, ie a shader not a shader graph. It copies the source code.
     
  31. drt_gamearound

    drt_gamearound

    Joined:
    Apr 1, 2013
    Posts:
    263
    I got it. So the resulting modified shader is the same shader (do the same job) as I did the Shader Graph I originally created. Right?
     
  32. drt_gamearound

    drt_gamearound

    Joined:
    Apr 1, 2013
    Posts:
    263
    If so, what happens with the textures I added during the shader graph editing? Shall I need to add them, or are the textures references incorporated to this new shader code?
     
  33. drt_gamearound

    drt_gamearound

    Joined:
    Apr 1, 2013
    Posts:
    263
    Ok. I got the whole process. So I will write down here to help others that are not shader experts:
    1. Create an Unlit shader (Create->Shader->Unlit Shader) and name it as you which (like MyShader).
    2. Open the shader you create with a shader graph for editing ("Open Shader Editr").
    3. Right-click the PBR Master (the last node of your shader at the right).
    4. At the menu choose "Copy shader".
    5. Close and go back to you Unlit shader from step 1. Double click to open the source code at Visual Studio or Mono.
    6. Select all the code. Delete it. Paste (You will paste the code you copy to clipboard on step 4.
    7. Now search for all the "struct GraphVertexOutput" and "struct SurfaceDescriptionInputs", change the uv under the struct from half to float (it is like "half4 uv0" and "half4 uv1" to be replaced by "float4 uv0" and "float4 uv1").
    *** Note there are many "struct GraphVertexOutput" and "struct SurfaceDescriptionInputs", so go one by one replacing only the half4
    8. Save the file.
    9. Go to your material, where the original shader graph was applied and replace the shader with Unlit/MyShader). Note this is the complete original shader including the embedded texture.
    10. Enjoy it.
     
    ROBYER1 likes this.
  34. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,058
    Damn, I have a 360 shader made with Shader Graph and was searching as to why my view was so pixelated even though it is a 4k texture (2:1). Applied the workaround (copy shader) and made it float4 precision and that worked fine.

    Since this thread originated from march and still hasn't been fixed... so is this by design or is this a bug?
    I've set my shader to float precision in the shader graph then I expect it to have float precision UV as well and not forced to half4.

    @aleksandrk any update on this whether it is a bug or by design? Or an issuetracker to keep track of the issue?
     
  35. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,845
    As I said earlier, it's a bug.
    I can't find this bug in our bug tracker. Can someone plase file a new one?
    Thanks!
     
  36. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,058
    I've filed a bug report case: 1203312
     
    ROBYER1 likes this.
  37. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,845
    Great, thanks!
     
  38. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,058
    The bug seems to be fixed in 2020.1a17 with LWRP 7.1.7, Shader Graph .7.1.7
    2019.2 still runs 6.9.2 so I hope this fix will be backported for 2019.x