Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertex count reducer #427

Open
sts1skj opened this issue Feb 11, 2022 · 2 comments
Open

Vertex count reducer #427

sts1skj opened this issue Feb 11, 2022 · 2 comments
Labels

Comments

@sts1skj
Copy link
Collaborator

sts1skj commented Feb 11, 2022

I've come across a few shapes in NIF files where every triangle had its own vertices. The number of vertices was three times the number of triangles. Many, many vertices could be safely merged, reducing the vertex count by roughly a factor of three. Though the merge option on the move-vertex tool lets you merge vertices one at a time, it would be nice if this could be automated.

I've seen other shapes that have ridiculously many vertices in some areas, spaced quite closely together. I doubt these extremely detailed meshes really need all those vertices to provide a good shape. Eliminating a lot of those vertices would likely result in a mesh that looks exactly the same in the game.

So maybe a vertex-count reducer could be useful. It could look for trivially merge-able vertices and merge them. It could look for vertices whose position, position diffs, weights, and texture coordinates are so close to being the average of two neighboring vertices that eliminating the vertex gives an insignificant change in the mesh shape and texture mapping, no matter the slider values or pose.

The algorithm would probably need a "simplification distance" parameter. Points would only be eliminated if the new mesh would be within the simplification distance of the point (for all slider values and poses). It'd probably need a "texture simplification distance" parameter too.

I'm assuming, of course, that reducing the vertex count has a benefit in the game: smaller file, less main memory, less graphics memory. I don't know if these things actually matter.

@GrafPanzer
Copy link

I think these functions could be useful, since simpler meshes use less resources, and any mesh over about 24k tris doesn't properly dismember in Fallout 4. If you implement these, I'd suggest limiting them to only the unmasked area of a mesh. They would be similar to the Merge By Distance, Decimate Geometry, and Limited Dissolve functions in Blender. It is important to keep all the original UV coordinates intact when performing these functions, as you mention. One problem in Blender is that algorithmic decimation doesn't look as nice as when it's done by hand. Instead of rows of nice triangulated quads, you tend to end up with meshes that look like the have flowers all over them (many faces originating from one vertex). Not sure if there's a way to avoid that.

@lensman11
Copy link

Would there also be an issue with front and back meshes being very close like simulating thin materials ie silks and nylon for stockings and possibly even body suits etc.
Regards Colin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants