2
$\begingroup$

I have an initial mesh with 4 vertices with indices 0,1,2,3 as shown in the first image with index 0 at the bottom left corner.

enter image description here

Now when I use a subsurf modifier and apply the modifier, the indices are changing as shown in the second image:

enter image description here

Now, is there a way in which I can keep the initial indices assigned to the same vertices so that I can access them later on from a script?

PS: I'm using subsurf modifier and not subdivide tool from edit mode because I have objects with more than 4 sides (before subdivision) and hence not able to use subdivide. I'm trying to create a uniform mesh for the object automatically and felt that using subsurf and triangulate and then applying them is giving me a decent mesh. (I know that I can select 4 vertices at a time make 4 sided faces initially and then use subdivide, but I am just thinking of alternate ways of doing this)

$\endgroup$
  • $\begingroup$ I am not 100% sure but I think the subdivide tool uses the initial geometry as a base, generates a subdivided version from it and replaces the original. You could try making your own subdivide routine in your script that respects the order you want(It's not that hard I saw at least two questions implementing this). $\endgroup$ – user2816 May 14 '16 at 5:00
  • $\begingroup$ Can you post the links of those two questions here? $\endgroup$ – Sum-Al May 16 '16 at 12:19
  • $\begingroup$ basic subdivision script $\endgroup$ – user2816 May 16 '16 at 16:30
  • $\begingroup$ @R00t Did you ever come across such retaining of indices algorithm after using remesh modifier? $\endgroup$ – Sum-Al May 18 '16 at 6:54
  • $\begingroup$ I haven't sorry $\endgroup$ – user2816 May 18 '16 at 17:20
1
$\begingroup$

Vertex indices are not meant to be used to reference the actual vertex. They are an internal position in a list, not some property of the verte itself. For instance if you apply the bevel modifier, how would you expect the indices to go? All of them have moved.

If you want to access the location of the original vertices, you could store a copy of the mesh. (not necessarily assigned to an object either) If you want to find the new vertices that map to the old ones, the only way I can think of is to iterate through the new objects vertices, find the closest old-mesh vertices, and threshold so only if they are very close does it count them as the same.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.