Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Dealing with 3D Tiles normals

Discussion in 'General Graphics' started by Guedez, Mar 22, 2020.

  1. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    825
    How can you get smooth normals between 3D tiles if you don't combine the mesh? I plan on rendering the pieces with Instancing, how is this usually solved?
    Images to clarify: https://imgur.com/a/EDGUI00
    These are also layed by the player, so there might be a ton of them, even if I were to merge the meshes, I would split into sections, so I would only be moving the issue.
     
  2. multivac

    multivac

    Joined:
    Oct 27, 2009
    Posts:
    133
    This should be handled in your modeling package.
    You'll need to make sure that the normals on tile edges are pointing in the same direction.
    Try to weld the seam between two tiles and break it apart again without regenerating the normals, it can speed up the process. If that isn't possible, you can still try to edit the normals on the tile edges directly.
     
  3. ColorStorm

    ColorStorm

    Joined:
    Jul 4, 2012
    Posts:
    28
    A bit late to the game, but I'm also working with this issue.

    There seems to be a couple of ways, and one i might use, is to manually avarage normals for all vertices thay overlaps a tile border. The problem with this is that hard normals is harder to handle in my mind. You have to check if the same mesh has 2 verts and if they check out to be hard normals, and skip evaluating those, or something.

    Another possible way, is to generate normals from some kind of hull, like a voxelspace(tile grid is basically a voxelspace). And just assign closest point of of the voxelspace to the vertex normals, and based on some rules, avoid doing it to hard edges. You have to generate normals from in the voxelspace like the voxels were cubes and had 8 smooth vertex corners.

    There are probably more solutions, but there seems to be no easy way. I'm still solving this on my end, But this is what i dug up.
     
  4. ColorStorm

    ColorStorm

    Joined:
    Jul 4, 2012
    Posts:
    28
    I tried exactly this, but having multiple permutations of tile combinations, you cannot know the angle of the normal. Sometimes they meet at 90 degrees, sometimes at 70, affecting the resulting avarage normal.
     
  5. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    825
    Yeah, in the end I just made all normals point up on all points that they may touch another similar mesh, even if the shadows may look strange, they don't look obviously wrong.
     
    ColorStorm likes this.