Search Unity

Water tiles: making them match

Discussion in 'General Graphics' started by joshcamas, Mar 22, 2018.

  1. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,278
    Hello friends!

    I have a little low poly water script that makes little waves, it's a c# script (and not a shader).

    However, naturally since my oceans are made out of tiles, the tiles do not match!


    How should I fix this?

    One idea is to make the edges of the mesh never move, but idk if I like that. Another is perhaps using world coordinates for the random seed generator? Not sure.

    -Josh
     
  2. Zee_pso

    Zee_pso

    Joined:
    Nov 12, 2016
    Posts:
    31
    I've done something similar for a shader, I used world coordinates so each tile lines up, so you got the right idea. Making the edges not move is a bad idea, since it will make it easy to see the seams, and make it look tiled.
     
  3. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    704
    You shouldn't use a pure random to make you vertices move, but instead use a function that relies on the world 3D coordinate (or at least X & Z) to move it.
    A good starting point could be this : https://docs.unity3d.com/ScriptReference/Mathf.PerlinNoise.html
    Example : vertex.y = Mathf.PerlinNoise( vertex.x, vertex.z );