Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Sprite diffuse shader shaking on iOS? Other shaders like Standard doesn't?

Discussion in 'Shaders' started by Raseru, Apr 25, 2015.

  1. Raseru

    Raseru

    Joined:
    Oct 4, 2013
    Posts:
    87
    My game runs fine in the editor, but on iOS platforms, as I move away from the origin (100+ units or so, floating point error I assume) the light begins to shake for some odd reason.

    Apparently this is not an issue with the standard shader, although the standard shader doesn't allow me to have negative scale to flip my sprites which causes issues.

    I'm new to shaders so I'm a little lost and would appreciate any guidance to get either shader working, thanks.
     
  2. echo4papa

    echo4papa

    Joined:
    Mar 26, 2015
    Posts:
    158
    Negative scale in a transform breaks a lot of the underlying math, and should probably be avoided.

    You should be able to flip your sprite easily with the new UI system though.
     
  3. Raseru

    Raseru

    Joined:
    Oct 4, 2013
    Posts:
    87
    Well the only other way to flip a sprite that I can find is through the rotation of the y-axis but that doesn't fix the issue. Sprites diffuse appears to be fundamentally flawed on iOS for lights in motion (ok in editor and android though) so I can't use it, and regular shaders don't render the back side of sprites which is necessary if I want to rotate by y-axis or reverse the scale.
     
  4. echo4papa

    echo4papa

    Joined:
    Mar 26, 2015
    Posts:
    158
    I've had some strange results when building to iOS if I select Metal as the graphics API. If it works on android, then try forcing OpenGL ES 2 or 3 and see if you still have the problem.
     
  5. Raseru

    Raseru

    Joined:
    Oct 4, 2013
    Posts:
    87
    Actually am using OpenGL ES 2, tried others with no luck. Maybe I'll see if I can kind of merge the shaders together.