Optimize as possible

Hi there!

I’m new in Shader graph and I like it so much!
so I would like to know how to optimize to improve performance as much as possible,

for Now I just changed a Precision to Half in Graph Setting, and the Shader seem to be
low quality a bit, I hope it should be high performance in mobile,

But another way to optimize I don’t know.
anyone has any suggestion?

Thanks!!!

There isn’t enough information here to make suggestions?

The very broad and general advice is “do less stuff”.

Most of the time main bottleneck on mobile GPU s are memory bandwidth. So these tips might improve GPU performance on Shaders:

  • Use lower precision
  • Use less Texture
  • Don’t use unnecessary texture channel (pack you texture maps)
  • Use lower resolution textures
  • Use cheapest possible Texture format for your use case

Also from I remember, there is no way to create simple lit equivalent on shader graph, so you might want to check this
https://github.com/Zallist/unity.zallist.universal-simple-lit-shadergraph-target

Thank you very much guy for your answer!

here is my Shader Graph screenshot

I changed Precision back to Single, because Half is looks weird in mobile

This is not always true on mobile, it’s more about balancing usage of samplers and math.

Another advice is to avoid functions like acos, tan, pow when possible as those are more expansive than adding or multiplication.

Personally I can’t see anything that can be heavily optimized, perhaps speed X and Y could be vector2, but I doubt that makes any sagnificant difference. The only thing that could be changed (but not sure if possible for you) to replace voronoi with texture sampling (assuming you target mobile), and that power node after voronoi, but it’s up to you if you manage to get good look with plain multiplication.

Get as many calculations done before sampling a texture is a good start point for shader optimization.

What do you mean?

Thank you very much everyone!

I changed things so much I has remove Pow and some matches node and then I wondering
about

Texture Sample vs Preview node

which one is heavier?

huh? how these two things related? Preview node is for debug purposes, it will be removed in compilation any ways also any calculation that not connected final block will be not performed and removed on compilation.

To be precise it will be “removed” not because it’s for debugging, but it literally does nothing.

@Rachan Looks like you are doing premature optimization. Did you try to measure performence? Any tests?
Or you are just trying to “optimize” just for sake of optimization?