Why is my mesh peeling off when I try to deform it during runtime?

I’m trying to deform meshes on runtime by doing some sort of “pressing/smooshing” effect

However when i try to do so my mesh “peels” because of the mesh’s seams
4512918a9f562dc7e131e7e95872f59752c5d624.gif

Also note that i need to use procedural generated meshes on runtime so i can’t just go to maya and connect vertices

What’s the trick behind deforming a mesh without “peeling” it?

Those triangles probably aren’t connected. Meaning they were side by side because of the position of their vertices and not because their triangles share the same vertex index.
Like triangle 1/2/3 and 4/5/6 are side by side but not like 1/2/3 and 2/3/4 or something similar.
From what I see your generation code makes several normalized faces that separate when you move the vertices around.
I’m not sure it’s going to be easy to fix at all.
In your generation code, you may edit the triangles at the seams to make sure they are interconnected, or modify the pushing code to make sure separation doesn’t happen by making adjacent vertices equal in position. Either way, if my assumptions are correct, it’s going to be a tough ride.

Looks like lighting is not being shared across different areas of the mesh. Topologically, any spherical mesh must have at least one discontinuity, a seam where vertices are duplicated, yet belong to either side of the seam. If you change one side, you must also change the other side.

I’m not exactly sure it would be the cause, since the seams cast a shadow below. I do agree on the topology of the sphere though, I remember seeing something like that on a math channel. So the problem can be mitigated but not prevented entirely.

I see two problems:

  • you need to move the shared vertex positions as a pair so you don’t physically rip a hole in the mesh

  • you need to recompute the lighting on either side of the seam so there is no discontinuity in the lighting, eg, you need to “re-fake” the original smoothing, even when it spans disparate verts

7437197--911402--two_problems.png

1 Like

So basically:
-find all the vertices that need to be “connected”
-make them move together
-make them move in the correct direction by giving them the same normal and correct normal.

is that approach good?

2 Likes

I’ve run into a weird problem where one of the verts that are not even being deformed will shoot through 0,0,0 and make some weird sharp point like so:
https://i.imgur.com/zm6gd2G.gif
https://i.imgur.com/Cd67Mad.gif

Why does this happen and what’s causing this to happen?

That looks like you’re manipulating a vertex on the other side of the mesh. We don’t know how you determine which vertices belong together. However it seems you’re doing something wrong. If it’s always the same vertex, maybe you always included vertex 0 or something?

Yeah it’s so weird because It’s happening for only vertex 0 but I’m not quite sure why it keeps getting selected as you can see here (blue sphere is the vertex 0): https://i.imgur.com/gvcaR4f.gif

I’m still trying to look but I can’t detect anything in my code that could cause this. Is it because I’m Raycasting so constantly that it picks up vertex 0?

Also, is there anything significant about vertex 0 other than being the first vertex of the mesh?