Search Unity

Question Shader looks VERY different on Android vs Windows

Discussion in 'General Graphics' started by GeriB, Jun 17, 2020.

  1. GeriB

    GeriB

    Joined:
    Apr 26, 2017
    Posts:
    192
    Hi, I'm working on a Hologram shader that looks like this in the editor and when I build it for Windows and WebGL:
    upload_2020-6-17_20-31-4.png
    But when I build it for Android the result is absolutely broken and different. The stripes take all the UV space or never appear depending on the settings.

    I've tried pretty much everything I can think of with no luck. This is the code of this effect:

    fixed stripes = floor((i.uv.y + ((_Time.x % 1) * _HologramStripesSpeed)) * _HologramStripesAmount);
    stripes = 1 - step(_HologramStripesFill, rand(fixed2(stripes, stripes), _RandomSeed));
    col.a *= lerp(col.a, _HologramStripesAlpha, stripes);
    col.rgb += col.rgb * stripes * _HologramStripesLuminosity;


    And this is the code of the rand function:

    fixed rand(fixed2 seed, fixed offset) {
    return (frac(sin(dot(seed, fixed2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0;
    }

    I'm using fixed variables and I suppose that there is some kind of overflow or something among these lines somewhere, but I have no clue where...

    Using GLES3.

    Any help would be immensely appreciated :)
    This thing is driving me insane.
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,014
    Try replacing with floats one by one :)
     
    GeriB likes this.