Search Unity

Visible seam when applying noise onto sphere

Discussion in 'Shaders' started by Elgskred, Sep 1, 2021.

  1. Elgskred

    Elgskred

    Joined:
    Oct 13, 2014
    Posts:
    9
    upload_2021-9-1_23-1-16.png

    As seen in the shaderGraph above, there is a visible seam, one for each half, this also applies in editor/game view.

    I can sort of get around it by applying a "Sample Texture 2d" node between the "Tiling and Offset" and "Voronoi" nodes, but this drasticly changes the result. The seam returns if I do it in any other order.

    How can I get rid of the seams?

    Currently enables packages:
    upload_2021-9-1_23-4-12.png
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    The UVs on any closed 3D volume (like a sphere, cube, etc, anything not a plane) will always have a seam. That's an avoidable side effect of trying to map a 2D coordinate system to a 3D shape. (this is analogous to the hairy ball theorem, yes that's a thing). Most of the time textures are setup to be seamlessly tiling; one edge of the texture matches up with the other edge. When you put a seamlessly tiling texture on a mesh like a sphere, it can appear as if there's no seam due to the texture hiding that seam, but it's still there.

    Unity's Voronoi node is not seamless. It's unbounded, so the further along the UV range you go it'll always be different. To "wrap" around a sphere like this you either need a 3D Voronoi and use the local space position, or you need a tiling Voronoi, neither of which Unity provides. You'd have to write your own voronoi node(s) or use a tiling Voronoi pattern baked into a texture in some external application, like Substance Designer.
     
    JG-Denver, Elgskred and esgnn like this.
  3. Elgskred

    Elgskred

    Joined:
    Oct 13, 2014
    Posts:
    9
    How come none of the tutorials I've been trying to follow have the same issue?
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Probably because they never turned the sphere around in the preview.
     
  5. Elgskred

    Elgskred

    Joined:
    Oct 13, 2014
    Posts:
    9
    Alright, thanks for your help.