Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nicoco007
Copy link
Contributor

@nicoco007 nicoco007 commented May 28, 2024

Adds some barebones utilities for populating the ClothProxyMapping section of a VisualBank resource. Testing against game meshes with this to get an idea of how accurate it is.

image

@nicoco007 nicoco007 force-pushed the add-cloth-proxy-mapping-utils branch 2 times, most recently from 54106a2 to 1fd66a0 Compare May 30, 2024 21:15
@nicoco007 nicoco007 marked this pull request as draft May 31, 2024 02:51
@nicoco007 nicoco007 force-pushed the add-cloth-proxy-mapping-utils branch 7 times, most recently from 0fa7a43 to 2f2aba1 Compare June 4, 2024 22:05
@nicoco007 nicoco007 force-pushed the add-cloth-proxy-mapping-utils branch 2 times, most recently from 875059c to 871afd2 Compare June 10, 2024 13:59

private static HashSet<ClothVertex> GetClothVertices(ClothMesh mesh)
{
var clothVertices = new HashSet<ClothVertex>(mesh.Vertices.Where(v => v.Weight > 0));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be easier to store an Added flag in ClothVertex.
This improves things in 3 ways:

  1. No need to build a HashSet out of verts
  2. AddOverlappingVertices and AddNeighboringVertices does not need to iterate over the complete set of vertices each time it is called, and re-check each vertex against the HashSet to see if it was added already; instead, if verts were kept in a List, AddOverlappingVertices and AddNeighboringVertices could just check the vert list starting from the last index they inspected, hence skipping verts whose neighbors and overlaps were already added.
  3. GetTargetClothVertices is simplified, as the output of GetClothVertices already contains a packed list of verts, so there is no need to separately build packedVertices

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're totally right about the first two points, but I don't think the 3rd one is possible since I need the final number of vertices to build packedVertices in the right order. I'm not sure it'd really be easier with an Added flag, but I'll see what I can do.

@nicoco007 nicoco007 force-pushed the add-cloth-proxy-mapping-utils branch from 871afd2 to 9ce1366 Compare June 15, 2024 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants