Anyone know if there is a way to re-order a model's vertices in 3ds Max 2015 (or any version, really) so they are numbered in order from bottom to top on the up axis?
I am making foliage for iOS/Unity, and alpha blend is required (PVR GPU renders alpha test much slower than alpha blend). But the transparency sorting is terrible.
Good thing is, my foliage is being used in an iso 3d game, so it's mostly viewed from above. If I order my vertices from bottom to top, I get reasonably good sorting. Bad thing is, 3ds Max keeps messing with my vertex order. I can detach and re-attach, but detaching kills my custom vertex normals.
Is there any tool that will help me re-order the verts along a particular axis (up axis would be great)?
Replies
It's pretty straight forward, import, go to edit mode, press space bar to search a fonction, type "sort mesh elements" and there you can sort vertices or faces (depending on your selection) along x/y/z/view/camera, etc...
Then, in object mode again, you could for instance add a Normal Edit modifier and set it to radial or directionnal to quickly re-customize your normals.
Export fbx and it's done.
Great info man!
Obj in the other hand does break vertex color.
Be careful with fbx though, it has to be exported in binary mode from your app. Blender cannot open ascii fbx yet.
New verts will append either at the bottom or top of the index. In Maya it's the bottom. Always meant to try that function in Blender, looks handy. Just for funsies, you can also get hardcore picky and use retop tools to manually work in the order you need. (not recommended, but you can get nice blends between interpenetrating faces if you have the time. or even for two quads that look like a plus sign from the top)
I'm 99% sure that Blender maintains vert index with obj, check your in/out options; I know many who use it for doing morphs alongside other apps.
woah ninja edit: I missed the part where you mentioned detaching.
no one tells me anything! this sounds neat. ( that reordering vrts along an axis may facilitate accurate sorting behavior )
Could u clear up confusion on my part?
Is the height in "up" independent of the faces the vrt is a member of?
Is the vrt order done face by face or a whole object?
If a whole object...
Does it matter if vrts are coincidental?
Can this be done in Maya?
Order is whole object. There is another set of vertices which have a different material assignment with no transparency (tree trunk) but I could strip those out beforehand.
Some of the vertices are duplicated in the same location, but that was only because I was detaching and reattaching clumps of triangles and not welding them afterwards. Those could be welded if needed.
Maya is fine! This could be a very handy tool for people. Especially if alpha testing is deprecated over time, for alpha blending. But it's certainly useful now given how iOS gpu works.
Wouldn't those vrts that couldn't be differentiated by height affect sorting benefit then?
Maybe examine all the vertices connected to the same triangle, and reorder the coincident vertices based on the middles of the triangles?
edited for slicker method that protects custom normal
another performance edit one too many sorts !
last edit move the clone out of the function
You made 2 lil mistakes tho Also Point01 isn't defined.
-- Error occurred in anonymous codeblock; filename: ; position: 1464; line: 42
-- Frame:
-- comparePoint3_Z: comparePoint3_Z()
-- sortedObj: undefined
-- compareInt: compareInt()
-- sortMeshVerts: sortMeshVerts()
-- Unknown property: "transform" in undefined
And the highlight is here:
sortedObj = SortMeshVerts (copy $) $Point01.transform;
you could replace it with
to give a vertical sort
I tried several tweaks to the script but nothing seemed to work properly, they always sorted from top to bottom, instead of bottom to top.
I just don't have the scripting chops to handle this properly
this line tells if it works upwards or downwards
this one should work the other way. (not tested)