Search Unity

Resolved Best way to get swirling noise?

Discussion in 'Shader Graph' started by Lo-renzo, Aug 20, 2020.

  1. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,514
    I want noise kind of like this (click for gif):
    Swirl.gif

    My current way to get noise like so is this hideous monstrosity. Capture.PNG
    I basically sample noise 3 times offset in different directions and add them together. But surely there's a better practice for this or nodes that I'm unaware of? I'm quite new to shaders in general.
     
  2. Oxeren

    Oxeren

    Joined:
    Aug 14, 2013
    Posts:
    121
    You can use 3d noise (you can find it here for example) and animate it's input z coordinate to get an effect like this.
    upload_2020-8-20_12-51-56.png
     
    adamgolden, florianhanke and Lo-renzo like this.
  3. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,514
    Great! Cool resource.

    Do you perhaps know how to get or produce something like kind of like Simple Noise but in 3D? Perlin/Simplex are more blob-like - with blobs appearing to come to the surface then diving - whereas Simple is more smoke-like, with its noise being more gradually tapering off. I've tried a bunch of ways to transform Simplex3D/Perlin3D into something more like Simple, but I haven't found a way yet.
     
  4. Oxeren

    Oxeren

    Joined:
    Aug 14, 2013
    Posts:
    121
    For that you could use 4D noise and animate it's W coordinate, but I haven't seen any implementations for shader graph. If you're familiar with custom functions, you can find an hlsl implementation (something like this, but I haven't tried it) and adapt it, should not be very difficult. Though I guess such shader would be rather expensive, but maybe not so much, can't say without testing.
    If you still need something more similar to shader graph's simple noise, look into value noises (that's what simple noise is) with higher dimensions (3d/4d) to try the same trick. Not sure if there are any ready implementations though.
    Another way would be to just bake a flipbook with noise animation in some 3d editor or maybe in Substance Designer or something like that. It would require figuring out how to make it loopable and, if needed, tileable, but you'll have much more control over the shape of the noise and it will be less expensive.
     
    Lo-renzo likes this.
  5. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,514
    For other people who might find this, I've found that the cheapest is to use a single SimpleNoise node that is multiplied against a simple texture kind of like this (but seamless). Both noise and texture are scrolled.
    Capture - Copy.PNG
    The blobs in the texture create spaces where swirls are less likely to appear. But can possibly appear if the SimpleNoise's signal is strong enough. Remap node used to tune it.