Search Unity

Tiling Texture Problem

Discussion in 'PSM' started by Boredman1234, Nov 20, 2014.

  1. Boredman1234

    Boredman1234

    Joined:
    Sep 17, 2013
    Posts:
    16
    I'm having the same problem as these guys. Basically, when I tile a lot on a large object(Terrain or mesh) the larger the object and the more I tile, the textures become more pixelated and jittery.

    This is on the Vita


    and this is it on desktop.



    The terrain shader is not the problem because it also occurs on meshes. From what I can gather from other threads, the problem is that the GPU has low precision and causes rounding errors or something. Does anyone know a good fix for this?

    Edit: While playing Need for Speed: Most Wanted, I discovered that it also has the same problem as I do. When you look at the terrain it jitters and behaves exactly like it does in my project. I suppose it is a problem with the Vita and there is no way around it.
     
    Last edited: Dec 8, 2014
  2. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    It looks like it could be imprecision in the UV coordinates.
    Basically - the tiling is repeated so many times that it eventually causes slight imprecision in the representation of the coordinates (similar to how floating point values become inexact if you deal with very large values).
    You could try changing the precision of the variables in your shader (see Precision of computations).
    Another solution is to 'split' your mesh at certain intervals to prevent it from reaching the point where UV coordinates get jittery.
     
  3. FranckS

    FranckS

    Joined:
    Jan 14, 2014
    Posts:
    29
    I have the same issue although my UVs are in floats throughout (other quantities are explicitely using halfs in my shader). eriQue, could it be that the compiler default options forces the vertex and fragment shaders to be compiled using halfs? If so is there a way to change that, as I prefer explicit control over precision?
     
  4. FranckS

    FranckS

    Joined:
    Jan 14, 2014
    Posts:
    29
    Also I derive my UVs from the vertex XZ position (no compression applied in the editor to that particular mesh) to save on incoming attributes. Could it be that the internal representation of position is in lower precision (like 24 bits per component or something)?
     
  5. FranckS

    FranckS

    Joined:
    Jan 14, 2014
    Posts:
    29
    Ok I got it.

    Basically the attributes interpolators are in 24 bits. Excerpt from the gpu doc:

    - UITR – USSE: The bus width is 64-bit. Each component of an attribute is processed as 24-bit float format (s1e8m15: 1-bit sign, 8-bit exponent, 15-bit mantissa), and forwarded as 32-bit float format (s1e8m23: 1-bit sign, 8-bit exponent, 23-bit mantissa). That is, the lower 8 bits of the 32-bit UITR output are always zero.
    - TITR – TAG: There are three 24-bit buses. Each component of a texture coordinate is processed and forward as 24-bit float format.

    They do this as a way to reduce the size of the parameter buffer (deferred hardware rendering).

    So as eriQue said, the only way is to split the mesh in smaller parts :(
     
  6. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    591
    i have something similar to that too maybe even more stranger the elevator should look like this 2014-12-07-134306.jpg but when i enter the elevator the textures go crazy they switch to the texture behind the elevator 2014-12-07-134310.jpg and then just a a small move the textures changes again 2014-12-07-134340.jpg so no matter i move the camera the textures changes again and again 2014-12-07-134335.jpg


    any idea guys what going on ? is that a bug or its an UVs issue ?
     
    Last edited: Dec 7, 2014
  7. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    377
    @blackbird - What shader for the elevator and the wall behind are you using?
    Are they in the same position so they're doing that Z-fighting thing where they are in the same position as each other.
     
    blackbird likes this.
  8. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    591
    i m just using mobile diffuse and the textures switching happens only on vita
     
  9. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    My first guess would also be Z-fighting - and that is dependent on the (hardware) Z-buffer resolution.
    So it's quite possible to get different results in on the Vita compared to the Editor.
     
    blackbird likes this.