Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Shader looks VERY different on Android vs Windows

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

  1. GeriB


    Apr 26, 2017
    Hi, I'm working on a Hologram shader that looks like this in the editor and when I build it for Windows and WebGL:
    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


    Unity Technologies

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