Search Unity

Strange tiling/seams in Simple Noise node

Discussion in 'Shaders' started by KaleidoVII, Jul 14, 2019.

  1. KaleidoVII

    KaleidoVII

    Joined:
    Dec 20, 2016
    Posts:
    2
    I'm working with Shader Graph in Unity 2019.1.0f2. The Simple Noise node that I am using shows strange artifacts in the texture that propagate all the way through to runtime. See below. What could be causing this? Do I need to be sampling with UVs in a particular way? Thank you!

    upload_2019-7-14_11-18-33.png

    upload_2019-7-14_11-20-33.png
     

    Attached Files:

  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    What OS and hardware are you using? Specifically what GPU? And what platform is your project set to?

    I don't necessarily have a solution, but the answer is you shouldn't need to do anything special. Unity is using a common sine based psuedo random value generator for the noise functions. That noise function has two major flaws. One is it's not a very good random value generator in the best case, and the other is it produces different values on different GPUs, sometimes very different to the point of being completely broken.

    Here's an example:
    https://www.shadertoy.com/view/4djSRW

    When the page first loads, both sides should look roughly the same. After about a 30 seconds the right side will start looking obviously worse, and continue to get worse looking. That right side is using roughly the same noise function as Unity.
    89D7C201-A77D-4E94-A7CA-790DE5E95F2D.jpeg

    A0827704-4910-480A-BC9D-8E13C46C3368.jpeg

    But on some GPUs the right side will start out looking less like noise and more a blocky mess. I'm going to guess that's what you see. The left side should look the same on almost all GPUs.
     
    BlackHoleTracer likes this.
  3. KaleidoVII

    KaleidoVII

    Joined:
    Dec 20, 2016
    Posts:
    2
    I think you're totally right! Mine looks like this after a few seconds:

    upload_2019-7-14_13-53-41.png

    System Info:

    OS: Windows 10
    Model: Dell Inspiron 7373
    CPU: Intel i5-8250U 1.6 GHz
    RAM: 8GB
    GPU: Intel UHD Graphics 620
    Building for Windows.

    I assume that the issue is that I'm using a laptop with integrated graphics. So this will perform fine on other hardware, you think? I'm just working away from my GTX 1080 desktop so I suppose this wouldn't be an issue if I build on that.
     

    Attached Files:

  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Yep, Intel integrated graphics and most mobile GPUs have a hard time with that noise function.
     
  5. NickJainschigg

    NickJainschigg

    Joined:
    Mar 11, 2013
    Posts:
    16
    I'm running into the same effect on an M1 Mac. It has a fast processor, but it seems to just mess up the noise texture faster ;)

    Does anyone know of any commercial or already-written noise generators that don't suffer from this? Or should I just content myself with using a large but actually tiling image texture? I should add that I"m not writing shaders, but using the Shader Graph.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    It depends on what you want. You can get away with an image a lot of the time.

    You could also potentially re-create the hash algorithms from that shadertoy : https://www.shadertoy.com/view/4djSRW

    They need dot and frac, presumably those are functions that Shader Graph has (I hope?).
     
  7. NickJainschigg

    NickJainschigg

    Joined:
    Mar 11, 2013
    Posts:
    16
    Thanks for the reply! i ended up using an online tool to generate a tiling Perlin noise and it's working fine.
     
    BlackHoleTracer likes this.