14-09-2021, 08:08 AM
(This post was last modified: 14-09-2021, 08:13 AM by josemendez.)
(13-09-2021, 10:15 PM)joe smith Wrote: [*]Q1> does it mean that ObiCloth will generate the same number of particles as inputMesh.vertexCount? (I thought it would create a sparse set of particles by approximating the input mesh)
[*]Q2> what is rawToWelded? I can find the name in the class reference but cannot find what it is.
[/list]Probably fundamental concepts but I cannot find any useful information from the class reference
Hi!
Both questions revolve around the same basic concept: welded or "shared" vertices.
You know meshes are basically a bunch of vertices and a list of triangles (triads of vertex indices). Each vertex has a position, a normal, a tangent, color, a texture coordinate, etc. However, you cannot have 2 normals per vertex, or 3 colors, or 2 texture coordinates. So what do you do when you must have a single vertex with different texture coordinates (a texture seam) or different normals?
Think of a simple cube: it has 8 vertices right?
Nope, it has 24: each vertex is shared by 3 faces, and each face has a different normal. Since you can't have a single vertex with 3 normals, at each corner of the cube you must have 3 vertices with the same position and a normal of their own each. This is a fundamental concept in mesh "anatomy".
Back to Obi cloth: when generating particles, it makes no sense to create one particle per vertex: many particles would end up overlapping, since there's multiple vertices with the exact same position (but different normals, texcoords, colors, etc). So vertices with the same position are welded into a single vertex, and a particle generated out of it.
This is where the rawToWelded array comes into play: it maps the index of a raw vertex to the index of a welded vertex / particle. So all this line does:
Code:
int particleIndex = blueprint.topology.rawToWelded[i];
Is get the particle index that corresponds to raw vertex "i".
let me know if you need further help. cheers!