Forum

How to generate vertex adjacency information for mesh?

hi all,

I have a GS that operates on triangles with adjacency. my output mesh has holes in it, and my suspicion is that every 2nd triangle is missing. because the GS shader takes 6 vertices and outputs 3 atm.

How do I add this adjacency info to my original model? my book says: “typically this only means expanding the element index array by factor two”. The vertex order for adjacency in GS should be: [V0, A1, V2, A3, V4, A5] where V are the vertices of my triangle, and A are the adjacent ones.

I know I should be generating a new list of indices, with the adjacent vectors included, but I am stuck.

in what order are the vertices of my mesh ordered at all.? If I use a generated mesh like dx9 sphere or grid, I should be able to calculate the indizes of my adjacent geometry. but that means keeping rows and columns in mind.

but how about a generic 3d model? how do I find out about adjacency and generate a valid index spread?

Adjacency is just an extra vertex / vertices, you access and provide it in geometry shader specially, I suggest you start from the line, I don’t remember correctly but I think you can read like 3 triangle vertices and 3 extra vertices in gs so your triangle is like 6 vertices, so you do something like vertex join and instead of giving 3 vertex per triangle you give 6