Search Unity

Question Optimize as much as possible!

Discussion in 'Shader Graph' started by Rachan, Jun 5, 2023.

  1. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    774
    Hi there!

    I working on my 2D game for mobile with Shader Graphs by (Alpha blend and Voronoi) included,
    But when I going to the scene with that Shader Graphs, the game will lag and jiggle a little bit
    I was played on my IPad mini2 from 2014 and yes, it slow down when I go to that scene,

    So I would like to optimize this Shader Graphs as much as possible,

    there has anyway or any suggestion for this Shader Graphs?

    Thanks!!!
     
    Last edited: Jun 5, 2023
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,042
    Use unlit output (and if needed calculate custom lighting)
    Use a texture instead of calculating the normal maps in realtime (if you make it loopable or zoom in you can scroll it for movement)
    Use half precision for most nodes (maybe not position if the position can be very big, otherwise it's fine)

    Remove nodes to find the ones causing the lag
     
    Rachan likes this.
  3. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    774
    Thank you very much for the tips!!!!
     
    DevDunk likes this.
  4. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    774
    I had changed all nodes to [Half] and a performance seem to be better!
    even some part are weird or must be wrong,

    so I want to know, how to properly select precisions?
    I have a lot of nodes and precision is [inherit],
    so I have to change all nods to [Half]?

    or just choose in Graph Settings from [Single] to [half]
    and let all nodes use in [Inherit]
    or choose [Use Graph Precision] instead?

    Thanks for your advice!
     
    Last edited: Jun 5, 2023
  5. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,042
    You can enable precision view in the dropdown around the right of the shader graph bar.
    I suggest checking the documentation and seeing the colors change when changing settings, that says more than me explaining it.
    Start with settings the graph to half if possible yes