Simple MXS "Game" Vertex Buffer Creation Script


and how to generate Tangent space vectors. The big speed bottleneck is getting the normals. Anyway someone might find it useful.

it might be worth noting generating the tangents like this give better results (less nasty seams at UV boundaries) than using the tangents generated via IGame.


heres an improved version of the optimize verts function without the binary search…


I don’t understand how the whole script works, neither which is the pourpose, but if you say that the big speed bottleneck is getting the normals, I suppose you are talking about the CollectNormals() function.

Perhaps you can get the render normal instead? This would be about 15 times faster and there is no need for the Edit Normals modifier. But as I said, I am not sure if this is what you need.

fn CollectNormals tmesh faces =
 	normals = #()
 	getfacernormals = meshop.getfacernormals
 	for j in faces do join normals (getfacernormals tmesh j)
 	return normals

If I could understand the whole thing perhaps I could help a bit more.


it’s only an issue if you need to handle explicit normals that were created from edit normal modifier otherwise you can cheat with



a version using render normals and a slightly improved hash (adds the original vert index)