Vertex Shader issue

I’m trying to create a complex shape in the vertex shader by deforming a circle SOP’s vertices. It is creating the shape I want but there are some really ugly artifacts where it looks like the vertices are being stretched accross the shape. I’m thinking it may be something to do with the way the geometry is created but I can’t figure out what. I’ve included the .toe file and any help would be much appreciated.

If you turn on wireframe for your glsl shader, you’ll see how openGL is deciding it’s going to tesselate your geometry:

Your input SOP has no triangles, so you’re effectively leaving it up to the backend to decide how it’s going to do it.

Problem is, even if you triangulated it, you’re still going to run into issues if the animation goes “against the grain” as in not in the direction of those long thin edges.

One potential solve for this is to generate or import a circle geometry that has a wheel spoke layout, with a vertex in the middle:

Using something like this allows your outer points to move with out criss cross with their neighbors so long as the points are not rotating around the center in non uniform ways:

btw the stepping you see around the edge is due to the mesh having duplicates verticies on top of each other which gives each one a different offset in the texture lookup you’re doing, so you’d need a way to pair those two verts together around the edge of the circle. maybe use int(vertexID/2) or something like that if the math works ok, in the textureLookup()

Thanks that makes perfect sense. I didn’t realise about the wireframe option in the glsl mat so that was really helpful.

1 Like