Search Unity

Unity's Mesh.vertices doesn't seem to connect all vertices. Why?

Discussion in 'Editor & General Support' started by Jordii, Dec 30, 2012.

  1. Jordii

    Jordii

    Joined:
    Sep 14, 2010
    Posts:
    135
    Yesterday I ran into a problem where I wanted to move some vertices of my model. However, when moving some around, I notice they seem to be detached from vertices in the exact same position. It happens to all sorts of models. Models I import from 3ds Max (default objects and self created ones) but also the default Cube object from Unity.

    Here is my example:

    When I run through Mesh.triangles for this specific model, these are the vertex indices associated:
    PHP:
    triangle 0012
    triangle 1
    321
    triangle 2
    234
    triangle 3
    153
    triangle 4
    516
    triangle 5
    761
    triangle 6
    482
    triangle 7
    928
    triangle 8
    8410
    triangle 9
    10118
    triangle 10
    12811
    triangle 11
    111013
    triangle 12
    131411
    triangle 13
    151114
    triangle 14
    141316
    triangle 15
    1735
    triangle 16
    181613
    triangle 17
    191310
    triangle 18
    20104
    triangle 19
    2143
    As you can see, some vertices are neglected. Vertex 0 for instance is ONLY used in triangle 0. However, if you look at my image it's on top and shared by others. Vertex 1 is perfectly shared. Now if I want to move vertex 1, this happens, which is what I want!



    However, when I move the neglected vertex 0 I get this:


    And when I move neglected vertex 15:


    I get this in all models I import (tried .FBX and .MAX). And each model seems to have some "unconnected" vertices floating around. Seeing I want to move vertices around along their normals this creates a weird "explosion"-like behaviour, because their normals are based on them being solo, thus moving OUT instead of as a group as in my example of moving vertex 1.

    I've also tried looking into the importer, but nothing came out of that. How can I make sure all vertices are "connected"?
     
  2. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,767
    If the vertices dont also share uv and normals then they will be duplicated, from your first image it looks like the uv mapping is causing the problem.
     
  3. Jordii

    Jordii

    Joined:
    Sep 14, 2010
    Posts:
    135
    Hey SpookyCat, thanks for your reply. I'm actually trying to build the displacement modifier you made in Mega-Fiers (don't worry, no commercial intensions, just for a hobby project ;)) so you might be the perfect person to ask. How did you handle this problem in Mega-Fiers where UV's are not connected?
     
  4. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    "For each vertex where position equals target vertex", move those too?!