Adjust code to generate tangent space when using vertex index